Add test for classes with variants
This commit is contained in:
parent
8e4de76a01
commit
73485e6d3d
24
test.js
24
test.js
|
@ -11,11 +11,11 @@ const disableCorePlugins = () => {
|
|||
})
|
||||
}
|
||||
|
||||
const generatePluginCss = () => {
|
||||
const generatePluginCss = (options = {}) => {
|
||||
return postcss(
|
||||
tailwindcss({
|
||||
corePlugins: disableCorePlugins(),
|
||||
plugins: [plugin()]
|
||||
plugins: [plugin(options)]
|
||||
})
|
||||
)
|
||||
.process('@tailwind utilities;', {
|
||||
|
@ -30,7 +30,7 @@ expect.extend({
|
|||
toMatchCss: cssMatcher
|
||||
})
|
||||
|
||||
test('it generates classes', () => {
|
||||
test('it generates the correct classes with no variants', () => {
|
||||
return generatePluginCss().then(css => {
|
||||
expect(css).toMatchCss(`
|
||||
.test {
|
||||
|
@ -39,3 +39,21 @@ test('it generates classes', () => {
|
|||
`)
|
||||
})
|
||||
})
|
||||
|
||||
test('it generates the correct classes with variants', () => {
|
||||
return generatePluginCss({ variants: ['hover', 'focus'] }).then(css => {
|
||||
expect(css).toMatchCss(`
|
||||
.test {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hover\\:test:hover {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.focus\\:test:focus {
|
||||
display: block;
|
||||
}
|
||||
`)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue