Skip to content

Commit

Permalink
test(cases): add @import tests (#290)
Browse files Browse the repository at this point in the history
* test: add test case for `@import`

* test: add another test case for `@import`
  • Loading branch information
sokra authored and evilebottnawi committed Oct 2, 2018
1 parent d7946d0 commit 770e28d
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/cases/at-import/a.css
@@ -0,0 +1,9 @@
@import './ae.css';
@import './aa.css';
@import './ab.css';
@import './ac.css';
@import './ad.css';

body {
background: red;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/aa.css
@@ -0,0 +1,3 @@
.aa {
background: green;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/ab.css
@@ -0,0 +1,3 @@
.ab {
background: green;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/ac.css
@@ -0,0 +1,3 @@
.ac {
background: green;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/ad.css
@@ -0,0 +1,3 @@
.ad {
background: green;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/ae.css
@@ -0,0 +1,3 @@
.ae {
background: green;
}
6 changes: 6 additions & 0 deletions test/cases/at-import/b.css
@@ -0,0 +1,6 @@
@import './ba.css';
@import './bb.css';

body {
background: yellow;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/ba.css
@@ -0,0 +1,3 @@
.ba {
background: green;
}
3 changes: 3 additions & 0 deletions test/cases/at-import/bb.css
@@ -0,0 +1,3 @@
.bb {
background: green;
}
36 changes: 36 additions & 0 deletions test/cases/at-import/expected/main.css
@@ -0,0 +1,36 @@
.ae {
background: green;
}

.aa {
background: green;
}

.ab {
background: green;
}

.ac {
background: green;
}

.ad {
background: green;
}

body {
background: red;
}

.ba {
background: green;
}

.bb {
background: green;
}

body {
background: yellow;
}

2 changes: 2 additions & 0 deletions test/cases/at-import/index.js
@@ -0,0 +1,2 @@
import './a.css';
import './b.css';
21 changes: 21 additions & 0 deletions test/cases/at-import/webpack.config.js
@@ -0,0 +1,21 @@
const Self = require('../../../');

module.exports = {
entry: './index.js',
module: {
rules: [
{
test: /\.css$/,
use: [
Self.loader,
'css-loader',
],
},
],
},
plugins: [
new Self({
filename: '[name].css',
}),
],
};
1 change: 1 addition & 0 deletions test/cases/css-import/a.css
@@ -0,0 +1 @@
body { background: red; }
5 changes: 5 additions & 0 deletions test/cases/css-import/b.css
@@ -0,0 +1,5 @@
.b { background: red; }

@import url("https://some/external/css");

.b { color: yellow; }
5 changes: 5 additions & 0 deletions test/cases/css-import/c.css
@@ -0,0 +1,5 @@
.c { background: red; }
@import './a.css';
@import url("https://some/other/external/css");

.c { color: yellow; }
14 changes: 14 additions & 0 deletions test/cases/css-import/expected/main.css
@@ -0,0 +1,14 @@
@import url(https://some/other/external/css);
@import url(https://some/external/css);
body { background: red; }

.c { background: red; }

.c { color: yellow; }

.b { background: red; }

.b { color: yellow; }



2 changes: 2 additions & 0 deletions test/cases/css-import/index.css
@@ -0,0 +1,2 @@
@import './c.css';
@import './b.css';
21 changes: 21 additions & 0 deletions test/cases/css-import/webpack.config.js
@@ -0,0 +1,21 @@
const Self = require('../../../');

module.exports = {
entry: './index.css',
module: {
rules: [
{
test: /\.css$/,
use: [
Self.loader,
'css-loader',
],
},
],
},
plugins: [
new Self({
filename: '[name].css',
}),
],
};

0 comments on commit 770e28d

Please sign in to comment.