@@ -41,19 +41,23 @@ describe('constants', () => {
41
41
42
42
it ( 'should import multiple from a single file' , ( ) => {
43
43
test (
44
- `@value blue, red from "./colors.css";
44
+ `@value blue, red, green as three from "./colors.css";
45
45
.foo { color: red; }
46
- .bar { color: blue }` ,
46
+ .bar { color: blue; }
47
+ .baz { color: three; }` ,
47
48
`:import("./colors.css") {
48
49
i__const_blue_0: blue;
49
50
i__const_red_1: red;
51
+ i__const_three_2: green;
50
52
}
51
53
:export {
52
54
blue: i__const_blue_0;
53
55
red: i__const_red_1;
56
+ three: i__const_three_2;
54
57
}
55
58
.foo { color: i__const_red_1; }
56
- .bar { color: i__const_blue_0 }` )
59
+ .bar { color: i__const_blue_0; }
60
+ .baz { color: i__const_three_2; }` )
57
61
} )
58
62
59
63
it ( 'should import from a definition' , ( ) => {
@@ -64,6 +68,13 @@ describe('constants', () => {
64
68
)
65
69
} )
66
70
71
+ it ( 'should compose from a definition' , ( ) => {
72
+ test (
73
+ '@value colors: "./colors.css"; .foo { composes: red from colors; }' ,
74
+ ':export {\n colors: "./colors.css";\n}\n.foo { composes: red from "./colors.css"; }'
75
+ )
76
+ } )
77
+
67
78
it ( 'should only allow values for paths if defined in the right order' , ( ) => {
68
79
test (
69
80
'@value red from colors; @value colors: "./colors.css";' ,
@@ -110,4 +121,21 @@ describe('constants', () => {
110
121
':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}\n' +
111
122
'.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); }' )
112
123
} )
124
+
125
+ it ( 'should allow box shadow definitions with rgba' , ( ) => {
126
+ test (
127
+ '@value okShadow: 0 11px 15px -7px rgba(0,0,0,.2);\n' +
128
+ '.foo { box-shadow: okShadow; }' ,
129
+ ':export {\n okShadow: 0 11px 15px -7px rgba(0,0,0,.2);\n}\n' +
130
+ '.foo { box-shadow: 0 11px 15px -7px rgba(0,0,0,.2); }'
131
+ )
132
+ } )
133
+
134
+ it ( 'should allow definitions with commas in them if quoted' , ( ) => {
135
+ test (
136
+ '@value coolShadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14);\n' +
137
+ '.foo { box-shadow: coolShadow; }' ,
138
+ ':export {\n coolShadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14);\n}\n' +
139
+ '.foo { box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14); }' )
140
+ } )
113
141
} )
0 commit comments