Move all files to tailwindcss-plugin-jest/
This commit is contained in:
parent
9935d675e3
commit
d4a1c1ddea
7 changed files with 0 additions and 0 deletions
53
tailwindcss-plugin-jest/test.js
Normal file
53
tailwindcss-plugin-jest/test.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
const cssMatcher = require('jest-matcher-css')
|
||||
const defaultConfig = require('tailwindcss/defaultConfig')
|
||||
const plugin = require('./index')
|
||||
const postcss = require('postcss')
|
||||
const tailwindcss = require('tailwindcss')
|
||||
|
||||
function run(options = {}) {
|
||||
return postcss(
|
||||
tailwindcss({
|
||||
corePlugins: false,
|
||||
plugins: [plugin(options)]
|
||||
})
|
||||
)
|
||||
.process('@tailwind utilities;', {
|
||||
from: undefined
|
||||
})
|
||||
}
|
||||
|
||||
expect.extend({
|
||||
toMatchCss: cssMatcher
|
||||
})
|
||||
|
||||
test('it generates the correct classes with no variants', () => {
|
||||
const output = `
|
||||
.test {
|
||||
display: block
|
||||
}
|
||||
`
|
||||
|
||||
run().then(result => {
|
||||
expect(result.css).toMatchCss(output)
|
||||
})
|
||||
})
|
||||
|
||||
test('it generates the correct classes with variants', () => {
|
||||
const output = `
|
||||
.test {
|
||||
display: block
|
||||
}
|
||||
|
||||
.hover\\:test:hover {
|
||||
display: block
|
||||
}
|
||||
|
||||
.focus\\:test:focus {
|
||||
display: block
|
||||
}
|
||||
`
|
||||
|
||||
run({ variants: ['hover', 'focus'] }).then(result => {
|
||||
expect(result.css).toMatchCss(output)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue