init
This commit is contained in:
commit
895b92a157
4 changed files with 76 additions and 0 deletions
41
test.js
Normal file
41
test.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
const _ = require('lodash')
|
||||
const cssMatcher = require('jest-matcher-css')
|
||||
const defaultConfig = require('tailwindcss/defaultConfig')
|
||||
const plugin = require('./index.js')
|
||||
const postcss = require('postcss')
|
||||
const tailwindcss = require('tailwindcss')
|
||||
|
||||
const disableCorePlugins = () => {
|
||||
return _.mapValues(defaultConfig.variants, plugin => {
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
const generatePluginCss = () => {
|
||||
return postcss(
|
||||
tailwindcss({
|
||||
corePlugins: disableCorePlugins(),
|
||||
plugins: [plugin()]
|
||||
})
|
||||
)
|
||||
.process('@tailwind utilities;', {
|
||||
from: undefined
|
||||
})
|
||||
.then(result => {
|
||||
return result.css
|
||||
})
|
||||
}
|
||||
|
||||
expect.extend({
|
||||
toMatchCss: cssMatcher
|
||||
})
|
||||
|
||||
test('it generates classes', () => {
|
||||
return generatePluginCss().then(css => {
|
||||
expect(css).toMatchCss(`
|
||||
.test {
|
||||
display: block;
|
||||
}
|
||||
`)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue