Skip to content

Commit 837f313

Browse files
test: more
1 parent 23e819d commit 837f313

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

test/runtime/__snapshots__/api.test.js.snap

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ exports[`api should toString with a source map without "sourceRoot" 1`] = `
2020

2121
exports[`api should toString with a source map without map 1`] = `"@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');"`;
2222

23-
exports[`api should toString with media query 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@media screen {body { a: 1; }}"`;
23+
exports[`api should toString with layer 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@layer(default) {body { a: 1; }}"`;
24+
25+
exports[`api should toString with media query list 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@media screen {body { a: 1; }}"`;
26+
27+
exports[`api should toString with media query list, layer and supports 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@layer(default) {@supports (display: grid) {@media screen {body { a: 1; }}}}"`;
2428

2529
exports[`api should toString with source mapping 1`] = `
2630
"@[object Object] {body { a: 1; }
2731
/*# sourceURL=webpack://./path/to/test.scss */
2832
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC5zY3NzIiwic291cmNlcyI6WyIuL3BhdGgvdG8vdGVzdC5zY3NzIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290Ijoid2VicGFjazovLyJ9 */}"
2933
`;
3034

35+
exports[`api should toString with supports 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@supports (display: grid) {body { a: 1; }}"`;
36+
3137
exports[`api should toString without source mapping if btoa not available 1`] = `"@[object Object] {body { a: 1; }}"`;

test/runtime/api.test.js

+55-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("api", () => {
4444
expect(m.toString()).toMatchSnapshot();
4545
});
4646

47-
it("should toString with media query", () => {
47+
it("should toString with media query list", () => {
4848
const m = api(noSourceMaps);
4949

5050
const m1 = [1, "body { a: 1; }", "screen"];
@@ -60,6 +60,60 @@ describe("api", () => {
6060
expect(m.toString()).toMatchSnapshot();
6161
});
6262

63+
it("should toString with layer", () => {
64+
const m = api(noSourceMaps);
65+
66+
const m1 = [1, "body { a: 1; }", "", "", "layer(default)"];
67+
const m2 = [2, "body { b: 2; }", ""];
68+
const m3 = [3, "body { c: 3; }", ""];
69+
const m4 = [4, "body { d: 4; }", ""];
70+
71+
m.i([m2, m3], "");
72+
m.i([m2], "");
73+
m.i([m2, m4], "print");
74+
m.push(m1);
75+
76+
expect(m.toString()).toMatchSnapshot();
77+
});
78+
79+
it("should toString with supports", () => {
80+
const m = api(noSourceMaps);
81+
82+
const m1 = [1, "body { a: 1; }", "", "supports (display: grid)"];
83+
const m2 = [2, "body { b: 2; }", ""];
84+
const m3 = [3, "body { c: 3; }", ""];
85+
const m4 = [4, "body { d: 4; }", ""];
86+
87+
m.i([m2, m3], "");
88+
m.i([m2], "");
89+
m.i([m2, m4], "print");
90+
m.push(m1);
91+
92+
expect(m.toString()).toMatchSnapshot();
93+
});
94+
95+
it("should toString with media query list, layer and supports", () => {
96+
const m = api(noSourceMaps);
97+
98+
const m1 = [
99+
1,
100+
"body { a: 1; }",
101+
"screen",
102+
"supports (display: grid)",
103+
"layer(default)",
104+
];
105+
const m2 = [2, "body { b: 2; }", ""];
106+
const m3 = [3, "body { c: 3; }", ""];
107+
const m4 = [4, "body { d: 4; }", ""];
108+
109+
m.i([m2, m3], "");
110+
m.i([m2], "");
111+
m.i([m2, m4], "print");
112+
m.push(m1);
113+
114+
expect(m.toString()).toMatchSnapshot();
115+
});
116+
63117
it("should import modules", () => {
64118
const m = api(noSourceMaps);
65119
const m1 = [1, "body { a: 1; }", "(orientation:landscape)"];

0 commit comments

Comments
 (0)