Skip to content

Commit 81ff67a

Browse files
refactor: modules option tests (#808) (#809)
1 parent b0db66f commit 81ff67a

File tree

54 files changed

+1735
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1735
-620
lines changed

test/__snapshots__/modules-option.test.js.snap

+1,581
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:local(.c1/*.c2*/.c3) { background: red; }

test/moduleTestCases/comments/source.css test/fixtures/modules/tests-cases/comments/source.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
*/
44

55
.bg {
6-
background-image: url(bg.jpg);
6+
background-image: url(./img.png);
77
}
88

99
/*
1010
* a ' below
11-
*/
11+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:local(.c2) {
2+
color: red;
3+
}
4+
5+
:local(.c4) {
6+
color: blue;
7+
}
8+
9+
.test{
10+
c: d
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.c1) { composes: c2 from "./file.css"; b: 1; }
2+
:local(.c3) { composes: c1; b: 3; }
3+
:local(.c5) { composes: c2 c4 from "./file.css"; b: 5; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:local(.c-2) {
2+
color: red;
3+
}
4+
5+
:local(.c4) {
6+
color: blue;
7+
}
8+
9+
.test{
10+
c: d
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.c1) { composes: c-2 from "./file.css"; b: 1; }
2+
:local(.c3) { composes: c1; b: 3; }
3+
:local(.c5) { composes: c-2 c4 from "./file.css"; b: 5; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.def1) {
2+
color: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.def2) {
2+
color: blue;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:local(.abc) {
2+
composes: def1 from "./file1.css";
3+
composes: def2 from "./file2.css";
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.def) {
2+
color: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.abc) {
2+
composes: def from "./file.css";
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:local(.c1) { a: 1; }
2+
:local(.c2) { composes: c1; b: 1; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:local(.className) { background: red; }
2+
:local(#someId) { background: green; }
3+
:local(.className .subClass) { color: green; }
4+
:local(#someId .subClass) { color: blue; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:local(.abc) {
2+
color: red;
3+
}
4+
:local(.def) {
5+
composes: abc;
6+
background: green;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:local(.c1[data-attr=".c2)]'"]:not(.c3):not(.c4)) {
2+
background: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.abc :local(.def) {
2+
color: red;
3+
}
4+
5+
:local .ghi .jkl {
6+
color: blue;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.c1 :local .c2 .c3 :global .c4 :local .c5, .c6 :local .c7 { background: red; }
2+
.c8 { background: red; }
76.3 KB
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.a {
2+
background: url(./img.png);
3+
background: url("./img.png");
4+
background: url("./img img.png");
5+
background: url('./img img.png');
6+
background: url('./img.png');
7+
background: url("./img.png#?iefix");
8+
background: url("#hash");
9+
background: url("#");
10+
background: url(data:image/png;base64,AAA);
11+
background: url(http://example.com/image.jpg);
12+
background: url(//example.com/image.png);
13+
background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) url(./img.png) xyz;
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@value def: red;
2+
@value ghi: 1px solid black;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@value def: red;
2+
.ghi { color: def; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@value def: red;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@value def from './file.css';
2+
.ghi { color: def; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@value def: red;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@value def: green;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@value def as aaa from './file1.css';
2+
@value def as bbb from './file2.css';
3+
.ghi { background: aaa, bbb, def; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@value color: red;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@value color from './file1.css';
2+
@value shadow: 0 0 color,0 0 color;
3+
.ghi { box-shadow: shadow; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@value color: red;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@value color from './file1.css';
2+
@value shadow: 0 0 color ,0 0 color;
3+
.ghi { box-shadow: shadow; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@value color: red;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@value color from './file1.css';
2+
@value shadow: 0 0 color, 0 0 color;
3+
.ghi { box-shadow: shadow; }

test/helpers.js

+11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ function evaluated(output, modules, moduleId = 1) {
3838
'import/node_modules',
3939
'url',
4040
'url/node_modules',
41+
'modules/tests-cases/urls',
42+
'modules/tests-cases/comments',
43+
'modules/tests-cases/values-3',
44+
'modules/tests-cases/values-4',
45+
'modules/tests-cases/values-5',
46+
'modules/tests-cases/values-6',
47+
'modules/tests-cases/values-7',
48+
'modules/tests-cases/composes-1',
49+
'modules/tests-cases/composes-2',
50+
'modules/tests-cases/composes-multiple',
51+
'modules/tests-cases/composes-with-importing',
4152
].map((importedPath) =>
4253
path.resolve(__dirname, `./fixtures/${importedPath}`, module)
4354
);

0 commit comments

Comments
 (0)