From c67912af6694ea7c847e3a9966db4bf388278476 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Mon, 5 Mar 2018 09:37:17 -0500 Subject: [PATCH] Add test to document checking the user's !important preference --- __tests__/processPlugins.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/__tests__/processPlugins.test.js b/__tests__/processPlugins.test.js index 12f1e64b9..f09c9a4e7 100644 --- a/__tests__/processPlugins.test.js +++ b/__tests__/processPlugins.test.js @@ -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 + } + } + `) +})