diff --git a/test.js b/test.js index fb41ce2..6251fc1 100644 --- a/test.js +++ b/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; + } + `) + }) +})