tailwindcss/tests/jit/basic-usage.test.js

34 lines
782 B
JavaScript
Raw Normal View History

import postcss from 'postcss'
import fs from 'fs'
import path from 'path'
import tailwind from '../../src/jit/index.js'
function run(input, config = {}) {
return postcss(tailwind(config)).process(input, {
from: path.resolve(__filename),
})
}
test('basic usage', () => {
let config = {
mode: 'jit',
purge: [path.resolve(__dirname, './basic-usage.test.html')],
corePlugins: { preflight: false },
theme: {},
plugins: [],
}
let css = `
@tailwind base;
@tailwind components;
@tailwind utilities;
`
return run(css, config).then((result) => {
let expectedPath = path.resolve(__dirname, './basic-usage.test.css')
let expected = fs.readFileSync(expectedPath, 'utf8')
2021-04-02 13:51:48 -04:00
expect(result.css).toMatchFormattedCss(expected)
})
})