Add test to document checking the user's !important preference

This commit is contained in:
Adam Wathan 2018-03-05 09:37:17 -05:00
parent 2feac441e7
commit c67912af66

View file

@ -470,3 +470,28 @@ test("leading '.' is optional when creating utilities via `utility`", () => {
}
`)
})
test("plugins can choose to make declarations !important", () => {
const [, utilities] = processPlugins({
plugins: [
function({ rule, addUtilities, config }) {
addUtilities([
rule('.skew-12deg', {
transform: `skewY(-12deg)${config('options.important') ? ' !important' : ''}`,
}),
])
},
],
options: {
important: true,
},
})
expect(css(utilities)).toMatchCss(`
@variants {
.skew-12deg {
transform: skewY(-12deg) !important
}
}
`)
})