-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathformat-variables.test.js
66 lines (59 loc) · 1.75 KB
/
format-variables.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
const tailwindcssVariables = require('../src/index')
const utils = require('./util/_utils')(__filename)
test('format variables [special characters must be removed from variable names]', async () => {
expect(
/* eslint-disable camelcase */
await utils.diffOnly({
content: [utils.content()],
darkMode: false,
theme: {
variables: {
DEFAULT: {
colors: {
"hello[$&+,:;=?@#|'<>.-^*()%!]WORLD": '100%',
underscore_to_dash: '100%',
'underscore_to_dash-with-dash': '100%',
auto_dash: '100%',
},
sizes: {
1.5: '1rem',
'foo2.0bar3.0': '2rem',
baz: {
'foo3.0bar4.0': '3rem',
},
},
},
"[type='button']": {
"hello[$&+,:;=?@#|'<>-^*()%!]world": '100%',
underscore_to_dash: '100%',
'underscore_to_dash-with-dash': '100%',
auto_dash: '100%',
nested_auto_dash: {
color__primary: '100%',
},
},
},
},
plugins: [tailwindcssVariables],
})
).toMatchInlineSnapshot(`
"
+ :root {
+ --colors-hello\\.-WORLD: 100%;
+ --colors-underscore-to-dash: 100%;
+ --colors-underscore-to-dash-with-dash: 100%;
+ --colors-auto-dash: 100%;
+ --sizes-1\\.5: 1rem;
+ --sizes-foo2\\.0bar3\\.0: 2rem;
+ --sizes-baz-foo3\\.0bar4\\.0: 3rem
+ }
+ [type='button'] {
+ --hello-world: 100%;
+ --underscore-to-dash: 100%;
+ --underscore-to-dash-with-dash: 100%;
+ --auto-dash: 100%;
+ --nested-auto-dash-color--primary: 100%
+ }
"
`)
})