Skip to content

Commit bb021d7

Browse files
test: more
1 parent 3b0ac43 commit bb021d7

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
@@ -43,7 +43,7 @@ describe("api", () => {
4343
expect(m.toString()).toMatchSnapshot();
4444
});
4545

46-
it("should toString with media query", () => {
46+
it("should toString with media query list", () => {
4747
const m = api((i) => i[1]);
4848

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

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

0 commit comments

Comments
 (0)