Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit 55eb739

Browse files
committed
Test important modifier when using prefix
1 parent eae1d13 commit 55eb739

File tree

4 files changed

+92
-1
lines changed

4 files changed

+92
-1
lines changed

tests/14-important-modifier.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function run(input, config = {}) {
77
return postcss([tailwind(config)]).process(input, { from: path.resolve(__filename) })
88
}
99

10-
test('important boolean', () => {
10+
test('important modifier', () => {
1111
let config = {
1212
important: false,
1313
darkMode: 'class',
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
* {
2+
--tw-shadow: 0 0 #0000;
3+
--tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
4+
--tw-ring-offset-width: 0px;
5+
--tw-ring-offset-color: #fff;
6+
--tw-ring-color: rgba(59, 130, 246, 0.5);
7+
--tw-ring-offset-shadow: 0 0 #0000;
8+
--tw-ring-shadow: 0 0 #0000;
9+
}
10+
.\!tw-container {
11+
width: 100% !important;
12+
}
13+
@media (min-width: 640px) {
14+
.\!tw-container {
15+
max-width: 640px !important;
16+
}
17+
}
18+
@media (min-width: 768px) {
19+
.\!tw-container {
20+
max-width: 768px !important;
21+
}
22+
}
23+
@media (min-width: 1024px) {
24+
.\!tw-container {
25+
max-width: 1024px !important;
26+
}
27+
}
28+
@media (min-width: 1280px) {
29+
.\!tw-container {
30+
max-width: 1280px !important;
31+
}
32+
}
33+
@media (min-width: 1536px) {
34+
.\!tw-container {
35+
max-width: 1536px !important;
36+
}
37+
}
38+
.\!tw-font-bold {
39+
font-weight: 700 !important;
40+
}
41+
.hover\:\!tw-text-center:hover {
42+
text-align: center !important;
43+
}
44+
@media (min-width: 1024px) {
45+
.lg\:\!tw-opacity-50 {
46+
opacity: 0.5 !important;
47+
}
48+
}
49+
@media (min-width: 1280px) {
50+
.xl\:focus\:disabled\:\!tw-float-right:focus:disabled {
51+
float: right !important;
52+
}
53+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div class="!tw-container"></div>
2+
<div class="!tw-font-bold"></div>
3+
<div class="hover:!tw-text-center"></div>
4+
<div class="lg:!tw-opacity-50"></div>
5+
<div class="xl:focus:disabled:!tw-float-right"></div>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const postcss = require('postcss')
2+
const tailwind = require('../src/index.js')
3+
const fs = require('fs')
4+
const path = require('path')
5+
6+
function run(input, config = {}) {
7+
return postcss([tailwind(config)]).process(input, { from: path.resolve(__filename) })
8+
}
9+
10+
test('important modifier with prefix', () => {
11+
let config = {
12+
important: false,
13+
prefix: 'tw-',
14+
darkMode: 'class',
15+
purge: [path.resolve(__dirname, './15-important-modifier-prefix.test.html')],
16+
corePlugins: { preflight: false },
17+
theme: {},
18+
plugins: [],
19+
}
20+
21+
let css = `
22+
@tailwind base;
23+
@tailwind components;
24+
@tailwind utilities;
25+
`
26+
27+
return run(css, config).then((result) => {
28+
let expectedPath = path.resolve(__dirname, './15-important-modifier-prefix.test.css')
29+
let expected = fs.readFileSync(expectedPath, 'utf8')
30+
31+
expect(result.css).toMatchCss(expected)
32+
})
33+
})

0 commit comments

Comments
 (0)