Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: added @media at-rules test #818

Merged
merged 2 commits into from Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions test/cases/at-media/a.css
@@ -0,0 +1,3 @@
body {
font-size: 24px;
}
3 changes: 3 additions & 0 deletions test/cases/at-media/b.css
@@ -0,0 +1,3 @@
body {
font-size: 32px;
}
3 changes: 3 additions & 0 deletions test/cases/at-media/c.css
@@ -0,0 +1,3 @@
body {
font-size: 64px;
}
3 changes: 3 additions & 0 deletions test/cases/at-media/d.css
@@ -0,0 +1,3 @@
body {
font-size: 128px;
}
3 changes: 3 additions & 0 deletions test/cases/at-media/e.css
@@ -0,0 +1,3 @@
body {
font-size: 256px;
}
40 changes: 40 additions & 0 deletions test/cases/at-media/expected/main.css
@@ -0,0 +1,40 @@
body {
font-size: 24px;
}

@media screen and (orientation: landscape) {
body {
font-size: 32px;
}

}
/*@import url("./c.css") supports(display: flex);*/
/*@import url("./d.css") supports(display: flex) screen and (min-width: 400px);*/
/*@import url("./e.css") supports( display : flex ) screen and ( min-width : 400px ) ;*/
/*@import url("./f.css") supports(not (display: flex));*/
/*@import url("./g.css") SUPPORTS(NOT (DISPLAY: FLEX));*/

div {
color: blue;
}

@media {
div {
color: red;
}
}

@media screen and (min-width: 900px) {
article {
padding: 1rem 3rem;
}
}

@supports (display: flex) {
@media screen and (min-width: 900px) {
article {
display: flex;
}
}
}

3 changes: 3 additions & 0 deletions test/cases/at-media/f.css
@@ -0,0 +1,3 @@
body {
font-size: 512px;
}
3 changes: 3 additions & 0 deletions test/cases/at-media/g.css
@@ -0,0 +1,3 @@
body {
font-size: 1024px;
}
1 change: 1 addition & 0 deletions test/cases/at-media/index.js
@@ -0,0 +1 @@
import "./style.css";
31 changes: 31 additions & 0 deletions test/cases/at-media/style.css
@@ -0,0 +1,31 @@
@import url("./a.css");
@import url("./b.css") screen and (orientation: landscape);
/*@import url("./c.css") supports(display: flex);*/
/*@import url("./d.css") supports(display: flex) screen and (min-width: 400px);*/
/*@import url("./e.css") supports( display : flex ) screen and ( min-width : 400px ) ;*/
/*@import url("./f.css") supports(not (display: flex));*/
/*@import url("./g.css") SUPPORTS(NOT (DISPLAY: FLEX));*/

div {
color: blue;
}

@media {
div {
color: red;
}
}

@media screen and (min-width: 900px) {
article {
padding: 1rem 3rem;
}
}

@supports (display: flex) {
@media screen and (min-width: 900px) {
article {
display: flex;
}
}
}
25 changes: 25 additions & 0 deletions test/cases/at-media/webpack.config.js
@@ -0,0 +1,25 @@
import Self from "../../../src";

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