tailwindcss/__tests__/hoverableAtRule.test.js

26 lines
640 B
JavaScript
Raw Normal View History

2017-10-21 11:26:30 -04:00
import postcss from 'postcss'
import plugin from '../src/lib/substituteHoverableAtRules'
2017-11-03 10:04:48 -04:00
function run(input, opts = () => {}) {
2017-10-21 11:26:30 -04:00
return postcss([plugin(opts)]).process(input)
}
test('it adds a hoverable variant to each nested class definition', () => {
2017-10-21 11:26:30 -04:00
const input = `
@hoverable {
.banana { color: yellow; }
.chocolate { color: brown; }
}
`
const output = `
.banana, .hover\\:banana:hover { color: yellow; }
.chocolate, .hover\\:chocolate:hover { color: brown; }
`
2017-11-03 10:04:48 -04:00
return run(input).then(result => {
2017-10-21 11:26:30 -04:00
expect(result.css).toEqual(output)
expect(result.warnings().length).toBe(0)
})
})