Skip to content

Commit 1527b06

Browse files
test: added @media at-rules test (#818)
1 parent f813b4c commit 1527b06

31 files changed

+118
-0
lines changed

test/cases/at-media/a.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 24px;
3+
}

test/cases/at-media/b.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 32px;
3+
}

test/cases/at-media/c.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 64px;
3+
}

test/cases/at-media/d.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 128px;
3+
}

test/cases/at-media/e.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 256px;
3+
}

test/cases/at-media/expected/main.css

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
body {
2+
font-size: 24px;
3+
}
4+
5+
@media screen and (orientation: landscape) {
6+
body {
7+
font-size: 32px;
8+
}
9+
10+
}
11+
/*@import url("./c.css") supports(display: flex);*/
12+
/*@import url("./d.css") supports(display: flex) screen and (min-width: 400px);*/
13+
/*@import url("./e.css") supports( display : flex ) screen and ( min-width : 400px ) ;*/
14+
/*@import url("./f.css") supports(not (display: flex));*/
15+
/*@import url("./g.css") SUPPORTS(NOT (DISPLAY: FLEX));*/
16+
17+
div {
18+
color: blue;
19+
}
20+
21+
@media {
22+
div {
23+
color: red;
24+
}
25+
}
26+
27+
@media screen and (min-width: 900px) {
28+
article {
29+
padding: 1rem 3rem;
30+
}
31+
}
32+
33+
@supports (display: flex) {
34+
@media screen and (min-width: 900px) {
35+
article {
36+
display: flex;
37+
}
38+
}
39+
}
40+

test/cases/at-media/f.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 512px;
3+
}

test/cases/at-media/g.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-size: 1024px;
3+
}

test/cases/at-media/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "./style.css";

test/cases/at-media/style.css

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@import url("./a.css");
2+
@import url("./b.css") screen and (orientation: landscape);
3+
/*@import url("./c.css") supports(display: flex);*/
4+
/*@import url("./d.css") supports(display: flex) screen and (min-width: 400px);*/
5+
/*@import url("./e.css") supports( display : flex ) screen and ( min-width : 400px ) ;*/
6+
/*@import url("./f.css") supports(not (display: flex));*/
7+
/*@import url("./g.css") SUPPORTS(NOT (DISPLAY: FLEX));*/
8+
9+
div {
10+
color: blue;
11+
}
12+
13+
@media {
14+
div {
15+
color: red;
16+
}
17+
}
18+
19+
@media screen and (min-width: 900px) {
20+
article {
21+
padding: 1rem 3rem;
22+
}
23+
}
24+
25+
@supports (display: flex) {
26+
@media screen and (min-width: 900px) {
27+
article {
28+
display: flex;
29+
}
30+
}
31+
}

test/cases/at-media/webpack.config.js

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

0 commit comments

Comments
 (0)