tailwindcss/__tests__/customConfig.test.js

66 lines
1.2 KiB
JavaScript
Raw Normal View History

import path from 'path'
import postcss from 'postcss'
import tailwind from '../src/index'
test('it uses the values from the custom config file', () => {
return postcss([tailwind(path.resolve(`${__dirname}/fixtures/customConfig.js`))])
2017-11-24 12:39:27 -05:00
.process(
`
2018-03-06 14:07:27 -05:00
@responsive {
.foo {
color: blue;
}
}
2018-03-06 14:07:27 -05:00
`,
{ from: undefined }
2017-11-24 12:39:27 -05:00
)
.then(result => {
const expected = `
.foo {
color: blue;
}
@media (min-width: 400px) {
.mobile\\:foo {
color: blue;
}
}
`
expect(result.css).toMatchCss(expected)
})
})
test('custom config can be passed as an object', () => {
2018-06-26 13:44:38 -04:00
return postcss([
tailwind({
screens: {
mobile: '400px',
},
}),
])
.process(
`
@responsive {
.foo {
color: blue;
}
}
`,
{ from: undefined }
)
.then(result => {
const expected = `
.foo {
color: blue;
}
@media (min-width: 400px) {
.mobile\\:foo {
color: blue;
}
}
`
expect(result.css).toMatchCss(expected)
})
})