Skip to content

Commit 179871d

Browse files
committed
Add curlies
1 parent ebd2374 commit 179871d

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

test/test.js

+57-57
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,65 @@ const run = (input) => postcss([plugin]).process(input)
55
const runCSS = (input) => run(input).then((result) => result.css)
66
const join = (...args) => args.join('\n')
77

8-
test('should pass through an empty string', () =>
9-
expect(runCSS('')).resolves.toEqual('')
10-
)
8+
test('should pass through an empty string', () => {
9+
return expect(runCSS('')).resolves.toEqual('')
10+
})
1111

12-
test('should export a constant', () =>
13-
expect(runCSS('@value red blue;@value red blue;')).resolves.toEqual(':export {\n red: blue\n}')
14-
)
12+
test('should export a constant', () => {
13+
return expect(runCSS('@value red blue;@value red blue;')).resolves.toEqual(':export {\n red: blue\n}')
14+
})
1515

16-
test('gives an error when there is no semicolon between lines', () =>
17-
run('@value red blue\n@value green yellow').then((result) => {
16+
test('gives an error when there is no semicolon between lines', () => {
17+
return run('@value red blue\n@value green yellow').then((result) => {
1818
const warnings = result.warnings()
1919

2020
expect(warnings.length).toEqual(1)
2121
expect(warnings[0].text).toEqual('Invalid value definition: red blue\n@value green yellow')
2222
})
23-
)
23+
})
2424

25-
test('should export a more complex constant', () =>
26-
expect(runCSS('@value small (max-width: 599px);')).resolves.toEqual(':export {\n small: (max-width: 599px)\n}')
27-
)
25+
test('should export a more complex constant', () => {
26+
return expect(runCSS('@value small (max-width: 599px);')).resolves.toEqual(':export {\n small: (max-width: 599px)\n}')
27+
})
2828

29-
test('should replace constants within the file', () =>
30-
expect(runCSS(
29+
test('should replace constants within the file', () => {
30+
return expect(runCSS(
3131
'@value blue red; .foo { color: blue; }'
3232
)).resolves.toEqual(
3333
':export {\n blue: red;\n}\n.foo { color: red; }'
3434
)
35-
)
35+
})
3636

37-
test('should import and re-export a simple constant', () =>
38-
expect(runCSS(
37+
test('should import and re-export a simple constant', () => {
38+
return expect(runCSS(
3939
'@value red from "./colors.css";'
4040
)).resolves.toEqual(
4141
':import("./colors.css") {\n i__const_red_0: red\n}\n:export {\n red: i__const_red_0\n}'
4242
)
43-
)
43+
})
4444

45-
test('should import a simple constant and replace usages', () =>
46-
expect(runCSS(
45+
test('should import a simple constant and replace usages', () => {
46+
return expect(runCSS(
4747
'@value red from "./colors.css"; .foo { color: red; }'
4848
)).resolves.toEqual(join(
4949
':import("./colors.css") {\n i__const_red_1: red;\n}',
5050
':export {\n red: i__const_red_1;\n}',
5151
'.foo { color: i__const_red_1; }'
5252
))
53-
)
53+
})
5454

55-
test('should import and alias a constant and replace usages', () =>
56-
expect(runCSS(
55+
test('should import and alias a constant and replace usages', () => {
56+
return expect(runCSS(
5757
'@value blue as red from "./colors.css"; .foo { color: red; }'
5858
)).resolves.toEqual(join(
5959
':import("./colors.css") {\n i__const_red_2: blue;\n}',
6060
':export {\n red: i__const_red_2;\n}',
6161
'.foo { color: i__const_red_2; }'
6262
))
63-
)
63+
})
6464

65-
test('should import multiple from a single file', () =>
66-
expect(runCSS(join(
65+
test('should import multiple from a single file', () => {
66+
return expect(runCSS(join(
6767
'@value blue, red from "./colors.css";',
6868
'.foo { color: red; }',
6969
'.bar { color: blue }'
@@ -73,74 +73,74 @@ test('should import multiple from a single file', () =>
7373
'.foo { color: i__const_red_4; }',
7474
'.bar { color: i__const_blue_3 }'
7575
))
76-
)
76+
})
7777

78-
test('should import from a definition', () =>
79-
expect(runCSS(
78+
test('should import from a definition', () => {
79+
return expect(runCSS(
8080
'@value colors: "./colors.css"; @value red from colors;'
8181
)).resolves.toEqual(join(
8282
':import("./colors.css") {\n i__const_red_5: red\n}',
8383
':export {\n colors: "./colors.css";\n red: i__const_red_5\n}'
8484
))
85-
)
85+
})
8686

87-
test('should only allow values for paths if defined in the right order', () =>
88-
expect(runCSS(
87+
test('should only allow values for paths if defined in the right order', () => {
88+
return expect(runCSS(
8989
'@value red from colors; @value colors: "./colors.css";'
9090
)).resolves.toEqual(join(
9191
':import(colors) {\n i__const_red_6: red\n}',
9292
':export {\n red: i__const_red_6;\n colors: "./colors.css"\n}'
9393
))
94-
)
94+
})
9595

96-
test('should allow transitive values', () =>
97-
expect(runCSS(
96+
test('should allow transitive values', () => {
97+
return expect(runCSS(
9898
'@value aaa: red;\n@value bbb: aaa;\n.a { color: bbb; }'
9999
)).resolves.toEqual(
100100
':export {\n aaa: red;\n bbb: red;\n}\n.a { color: red; }'
101101
)
102-
)
102+
})
103103

104-
test('should allow transitive values within calc', () =>
105-
expect(runCSS(
104+
test('should allow transitive values within calc', () => {
105+
return expect(runCSS(
106106
'@value base: 10px;\n@value large: calc(base * 2);\n.a { margin: large; }'
107107
)).resolves.toEqual(
108108
':export {\n base: 10px;\n large: calc(10px * 2);\n}\n.a { margin: calc(10px * 2); }'
109109
)
110-
)
110+
})
111111

112-
test('should preserve import order', () =>
113-
expect(runCSS(
112+
test('should preserve import order', () => {
113+
return expect(runCSS(
114114
'@value a from "./a.css"; @value b from "./b.css";'
115115
)).resolves.toEqual(join(
116116
':import("./a.css") {\n i__const_a_7: a\n}',
117117
':import("./b.css") {\n i__const_b_8: b\n}',
118118
':export {\n a: i__const_a_7;\n b: i__const_b_8\n}'
119119
))
120-
)
120+
})
121121

122-
test('should allow custom-property-style names', () =>
123-
expect(runCSS(
122+
test('should allow custom-property-style names', () => {
123+
return expect(runCSS(
124124
'@value --red from "./colors.css"; .foo { color: --red; }'
125125
)).resolves.toEqual(join(
126126
':import("./colors.css") {\n i__const___red_9: --red;\n}',
127127
':export {\n --red: i__const___red_9;\n}',
128128
'.foo { color: i__const___red_9; }'
129129
))
130-
)
130+
})
131131

132-
test('should allow all colour types', () =>
133-
expect(runCSS(join(
132+
test('should allow all colour types', () => {
133+
return expect(runCSS(join(
134134
'@value named: red; @value 3char #0f0; @value 6char #00ff00; @value rgba rgba(34, 12, 64, 0.3); @value hsla hsla(220, 13.0%, 18.0%, 1);',
135135
'.foo { color: named; background-color: 3char; border-top-color: 6char; border-bottom-color: rgba; outline-color: hsla; }'
136136
))).resolves.toEqual(join(
137137
':export {\n named: red;\n 3char: #0f0;\n 6char: #00ff00;\n rgba: rgba(34, 12, 64, 0.3);\n hsla: hsla(220, 13.0%, 18.0%, 1);\n}',
138138
'.foo { color: red; background-color: #0f0; border-top-color: #00ff00; border-bottom-color: rgba(34, 12, 64, 0.3); outline-color: hsla(220, 13.0%, 18.0%, 1); }'
139139
))
140-
)
140+
})
141141

142-
test('should import multiple from a single file on multiple lines', () =>
143-
expect(runCSS(join(
142+
test('should import multiple from a single file on multiple lines', () => {
143+
return expect(runCSS(join(
144144
'@value (\n blue,\n red\n) from "./colors.css";',
145145
'.foo { color: red; }',
146146
'.bar { color: blue }'
@@ -150,22 +150,22 @@ test('should import multiple from a single file on multiple lines', () =>
150150
'.foo { color: i__const_red_11; }',
151151
'.bar { color: i__const_blue_10 }'
152152
))
153-
)
153+
})
154154

155-
test('should allow definitions with commas in them', () =>
156-
expect(runCSS(join(
155+
test('should allow definitions with commas in them', () => {
156+
return expect(runCSS(join(
157157
'@value coolShadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14) ;',
158158
'.foo { box-shadow: coolShadow; }'
159159
))).resolves.toEqual(join(
160160
':export {\n coolShadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14);\n}',
161161
'.foo { box-shadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14); }'
162162
))
163-
)
163+
})
164164

165-
test('should allow values with nested parantheses', () =>
166-
expect(runCSS(
165+
test('should allow values with nested parantheses', () => {
166+
return expect(runCSS(
167167
'@value aaa: color(red lightness(50%));'
168168
)).resolves.toEqual(
169169
':export {\n aaa: color(red lightness(50%))\n}'
170170
)
171-
)
171+
})

0 commit comments

Comments
 (0)