Add basic test for hoverable at-rule
This commit is contained in:
parent
481b19e50e
commit
c989134554
1 changed files with 25 additions and 0 deletions
25
__tests__/hoverableAtRule.test.js
Normal file
25
__tests__/hoverableAtRule.test.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import postcss from 'postcss'
|
||||
import plugin from '../src/lib/substituteHoverableAtRules'
|
||||
|
||||
function run(input, opts = {}) {
|
||||
return postcss([plugin(opts)]).process(input)
|
||||
}
|
||||
|
||||
test("it adds a hoverable variant to each nested class definition", () => {
|
||||
const input = `
|
||||
@hoverable {
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
}
|
||||
`
|
||||
|
||||
const output = `
|
||||
.banana, .hover\\:banana:hover { color: yellow; }
|
||||
.chocolate, .hover\\:chocolate:hover { color: brown; }
|
||||
`
|
||||
|
||||
return run(input, {}).then(result => {
|
||||
expect(result.css).toEqual(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue