Skip to content

Commit 770e28d

Browse files
sokraevilebottnawi
authored andcommitted
test(cases): add @import tests (#290)
* test: add test case for `@import` * test: add another test case for `@import`
1 parent d7946d0 commit 770e28d

File tree

18 files changed

+143
-0
lines changed

18 files changed

+143
-0
lines changed

test/cases/at-import/a.css

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import './ae.css';
2+
@import './aa.css';
3+
@import './ab.css';
4+
@import './ac.css';
5+
@import './ad.css';
6+
7+
body {
8+
background: red;
9+
}

test/cases/at-import/aa.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.aa {
2+
background: green;
3+
}

test/cases/at-import/ab.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ab {
2+
background: green;
3+
}

test/cases/at-import/ac.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ac {
2+
background: green;
3+
}

test/cases/at-import/ad.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ad {
2+
background: green;
3+
}

test/cases/at-import/ae.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ae {
2+
background: green;
3+
}

test/cases/at-import/b.css

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@import './ba.css';
2+
@import './bb.css';
3+
4+
body {
5+
background: yellow;
6+
}

test/cases/at-import/ba.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ba {
2+
background: green;
3+
}

test/cases/at-import/bb.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.bb {
2+
background: green;
3+
}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.ae {
2+
background: green;
3+
}
4+
5+
.aa {
6+
background: green;
7+
}
8+
9+
.ab {
10+
background: green;
11+
}
12+
13+
.ac {
14+
background: green;
15+
}
16+
17+
.ad {
18+
background: green;
19+
}
20+
21+
body {
22+
background: red;
23+
}
24+
25+
.ba {
26+
background: green;
27+
}
28+
29+
.bb {
30+
background: green;
31+
}
32+
33+
body {
34+
background: yellow;
35+
}
36+

test/cases/at-import/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import './a.css';
2+
import './b.css';
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const Self = require('../../../');
2+
3+
module.exports = {
4+
entry: './index.js',
5+
module: {
6+
rules: [
7+
{
8+
test: /\.css$/,
9+
use: [
10+
Self.loader,
11+
'css-loader',
12+
],
13+
},
14+
],
15+
},
16+
plugins: [
17+
new Self({
18+
filename: '[name].css',
19+
}),
20+
],
21+
};

test/cases/css-import/a.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body { background: red; }

test/cases/css-import/b.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.b { background: red; }
2+
3+
@import url("https://some/external/css");
4+
5+
.b { color: yellow; }

test/cases/css-import/c.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.c { background: red; }
2+
@import './a.css';
3+
@import url("https://some/other/external/css");
4+
5+
.c { color: yellow; }
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@import url(https://some/other/external/css);
2+
@import url(https://some/external/css);
3+
body { background: red; }
4+
5+
.c { background: red; }
6+
7+
.c { color: yellow; }
8+
9+
.b { background: red; }
10+
11+
.b { color: yellow; }
12+
13+
14+

test/cases/css-import/index.css

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import './c.css';
2+
@import './b.css';
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const Self = require('../../../');
2+
3+
module.exports = {
4+
entry: './index.css',
5+
module: {
6+
rules: [
7+
{
8+
test: /\.css$/,
9+
use: [
10+
Self.loader,
11+
'css-loader',
12+
],
13+
},
14+
],
15+
},
16+
plugins: [
17+
new Self({
18+
filename: '[name].css',
19+
}),
20+
],
21+
};

0 commit comments

Comments
 (0)