Skip to content

Commit

Permalink
refactor: modules option tests (#808) (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Nov 27, 2018
1 parent b0db66f commit 81ff67a
Show file tree
Hide file tree
Showing 54 changed files with 1,735 additions and 620 deletions.
1,581 changes: 1,581 additions & 0 deletions test/__snapshots__/modules-option.test.js.snap

Large diffs are not rendered by default.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:local(.c1/*.c2*/.c3) { background: red; }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/

.bg {
background-image: url(bg.jpg);
background-image: url(./img.png);
}

/*
* a ' below
*/
*/
11 changes: 11 additions & 0 deletions test/fixtures/modules/tests-cases/composes-1/file.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:local(.c2) {
color: red;
}

:local(.c4) {
color: blue;
}

.test{
c: d
}
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/composes-1/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.c1) { composes: c2 from "./file.css"; b: 1; }
:local(.c3) { composes: c1; b: 3; }
:local(.c5) { composes: c2 c4 from "./file.css"; b: 5; }
11 changes: 11 additions & 0 deletions test/fixtures/modules/tests-cases/composes-2/file.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:local(.c-2) {
color: red;
}

:local(.c4) {
color: blue;
}

.test{
c: d
}
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/composes-2/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.c1) { composes: c-2 from "./file.css"; b: 1; }
:local(.c3) { composes: c1; b: 3; }
:local(.c5) { composes: c-2 c4 from "./file.css"; b: 5; }
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/composes-multiple/file1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.def1) {
color: red;
}
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/composes-multiple/file2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.def2) {
color: blue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:local(.abc) {
composes: def1 from "./file1.css";
composes: def2 from "./file2.css";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.def) {
color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.abc) {
composes: def from "./file.css";
}
2 changes: 2 additions & 0 deletions test/fixtures/modules/tests-cases/composes/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:local(.c1) { a: 1; }
:local(.c2) { composes: c1; b: 1; }
File renamed without changes.
4 changes: 4 additions & 0 deletions test/fixtures/modules/tests-cases/local-2/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:local(.className) { background: red; }
:local(#someId) { background: green; }
:local(.className .subClass) { color: green; }
:local(#someId .subClass) { color: blue; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:local(.abc) {
color: red;
}
:local(.def) {
composes: abc;
background: green;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local(.c1[data-attr=".c2)]'"]:not(.c3):not(.c4)) {
background: red;
}
7 changes: 7 additions & 0 deletions test/fixtures/modules/tests-cases/local/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.abc :local(.def) {
color: red;
}

:local .ghi .jkl {
color: blue;
}
2 changes: 2 additions & 0 deletions test/fixtures/modules/tests-cases/mode-switching/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.c1 :local .c2 .c3 :global .c4 :local .c5, .c6 :local .c7 { background: red; }
.c8 { background: red; }
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/modules/tests-cases/urls/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions test/fixtures/modules/tests-cases/urls/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.a {
background: url(./img.png);
background: url("./img.png");
background: url("./img img.png");
background: url('./img img.png');
background: url('./img.png');
background: url("./img.png#?iefix");
background: url("#hash");
background: url("#");
background: url(data:image/png;base64,AAA);
background: url(http://example.com/image.jpg);
background: url(//example.com/image.png);
background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) url(./img.png) xyz;
}
2 changes: 2 additions & 0 deletions test/fixtures/modules/tests-cases/values-1/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@value def: red;
@value ghi: 1px solid black;
2 changes: 2 additions & 0 deletions test/fixtures/modules/tests-cases/values-2/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@value def: red;
.ghi { color: def; }
1 change: 1 addition & 0 deletions test/fixtures/modules/tests-cases/values-3/file.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value def: red;
2 changes: 2 additions & 0 deletions test/fixtures/modules/tests-cases/values-3/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@value def from './file.css';
.ghi { color: def; }
1 change: 1 addition & 0 deletions test/fixtures/modules/tests-cases/values-4/file1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value def: red;
1 change: 1 addition & 0 deletions test/fixtures/modules/tests-cases/values-4/file2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value def: green;
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/values-4/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@value def as aaa from './file1.css';
@value def as bbb from './file2.css';
.ghi { background: aaa, bbb, def; }
1 change: 1 addition & 0 deletions test/fixtures/modules/tests-cases/values-5/file1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value color: red;
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/values-5/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@value color from './file1.css';
@value shadow: 0 0 color,0 0 color;
.ghi { box-shadow: shadow; }
1 change: 1 addition & 0 deletions test/fixtures/modules/tests-cases/values-6/file1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value color: red;
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/values-6/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@value color from './file1.css';
@value shadow: 0 0 color ,0 0 color;
.ghi { box-shadow: shadow; }
1 change: 1 addition & 0 deletions test/fixtures/modules/tests-cases/values-7/file1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value color: red;
3 changes: 3 additions & 0 deletions test/fixtures/modules/tests-cases/values-7/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@value color from './file1.css';
@value shadow: 0 0 color, 0 0 color;
.ghi { box-shadow: shadow; }
File renamed without changes.
11 changes: 11 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ function evaluated(output, modules, moduleId = 1) {
'import/node_modules',
'url',
'url/node_modules',
'modules/tests-cases/urls',
'modules/tests-cases/comments',
'modules/tests-cases/values-3',
'modules/tests-cases/values-4',
'modules/tests-cases/values-5',
'modules/tests-cases/values-6',
'modules/tests-cases/values-7',
'modules/tests-cases/composes-1',
'modules/tests-cases/composes-2',
'modules/tests-cases/composes-multiple',
'modules/tests-cases/composes-with-importing',
].map((importedPath) =>
path.resolve(__dirname, `./fixtures/${importedPath}`, module)
);
Expand Down
Loading

0 comments on commit 81ff67a

Please sign in to comment.