-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathfallback.test.js
89 lines (82 loc) · 2.29 KB
/
fallback.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const tailwindcssVariables = require('../src/index')
const utils = require('./util/_utils')(__filename)
const colorVariable = require('../colorVariable')
test('fallback', async () => {
expect(
await utils.diffOnly({
corePlugins: ['textColor', 'textOpacity', 'backgroundColor', 'backgroundOpacity'],
content: [utils.content()],
darkMode: false,
theme: {
screens: false,
colors: {
red: {
400: 'var(--colors-red-400 red)',
500: 'var(--colors-red red)',
600: colorVariable('var(--header-color, black)'),
700: colorVariable('var(--header-color, black)', true),
800: colorVariable('var(--header-color, black)', false),
},
gray: 'var(--header-color, blue)',
},
variables: {
DEFAULT: {
header: {
color: '#ffffff',
},
colors: {
red: {
DEFAULT: '#ff0000',
400: '#ff3f3f',
},
},
},
},
},
plugins: [
tailwindcssVariables({
colorVariables: true,
}),
],
})
).toMatchInlineSnapshot(`
"
-
+ :root {
+ --header-color: #ffffff;
+ --header-color-rgb: 255,255,255;
+ --colors-red-400: #ff3f3f;
+ --colors-red: #ff0000;
+ --colors-red-400-rgb: 255,63,63;
+ --colors-red-rgb: 255,0,0
+ }
+ .component .header {
+ color: var(--colors-red-400 red)
+ }
+ .bg-gray {
+ background-color: var(--header-color, blue)
+ }
+ .bg-red-400 {
+ background-color: var(--colors-red-400 red)
+ }
+ .bg-red-500 {
+ background-color: var(--colors-red red)
+ }
+ .bg-red-600 {
+ --tw-bg-opacity: 1;
+ background-color: rgba(var(--header-color-rgb, black), var(--tw-bg-opacity))
+ }
+ .bg-red-700 {
+ --tw-bg-opacity: 1;
+ background-color: rgba(var(--header-color, black), var(--tw-bg-opacity))
+ }
+ .bg-opacity-50 {
+ --tw-bg-opacity: 0.5
+ }
+ .text-red-800 {
+ --tw-text-opacity: 1;
+ color: rgba(var(--header-color-rgb, black), var(--tw-text-opacity))
+ }
"
`)
})