Skip to content

Commit 4804a2d

Browse files
test: more
1 parent 28ab0aa commit 4804a2d

13 files changed

+1211
-56
lines changed

src/plugins/postcss-import-parser.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ function parseNode(atRule, key) {
5050
throw error;
5151
}
5252

53-
const { nodes: paramsNodes } = valueParser(atRule[key]);
53+
const rawParams =
54+
atRule.raws &&
55+
atRule.raws[key] &&
56+
typeof atRule.raws[key].raw !== "undefined"
57+
? atRule.raws[key].raw
58+
: atRule[key];
59+
const { nodes: paramsNodes } = valueParser(rawParams);
5460

5561
// No nodes - `@import ;`
5662
// Invalid type - `@import foo-bar;`

test/__snapshots__/import-option.test.js.snap

Lines changed: 1148 additions & 50 deletions
Large diffs are not rendered by default.

test/__snapshots__/sourceMap-option.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ exports[`"sourceMap" option true should generate source maps when css was extrac
313313
exports[`"sourceMap" option true should generate source maps when css was extracted and do not change "[contenthash]" on different platform: source map 1`] = `
314314
Object {
315315
"file": "main.xxxxxxxxxxxxxxxxxxxx.css",
316-
"mappings": "AAAA;EACE,WAAW;AACb;;;;;ACAA;EACE,UAAU;AACZ",
316+
"mappings": ";;;AAAA;EACE,WAAW;AACb;;;;;ACAA;EACE,UAAU;AACZ",
317317
"names": Array [],
318318
"sourceRoot": "",
319319
"sources": Array [
@@ -362,7 +362,7 @@ exports[`"sourceMap" option true should generate source maps when css was extrac
362362
exports[`"sourceMap" option true should generate source maps when css was extracted: source map 1`] = `
363363
Object {
364364
"file": "main.css",
365-
"mappings": "AAAA;EACE,WAAW;AACb;;;;;ACAA;EACE,UAAU;AACZ",
365+
"mappings": ";;;AAAA;EACE,WAAW;AACb;;;;;ACAA;EACE,UAAU;AACZ",
366366
"names": Array [],
367367
"sourceRoot": "",
368368
"sources": Array [

test/__snapshots__/validate-options.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ exports[`validate options should throw an error on the "importLoaders" option wi
6363
Details:
6464
* options.importLoaders should be a boolean.
6565
* options.importLoaders should be a string.
66-
* options.importLoaders should be a integer."
66+
* options.importLoaders should be an integer."
6767
`;
6868
6969
exports[`validate options should throw an error on the "modules" option with "{"auto":"invalid"}" value 1`] = `
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import css from './import.css';
2+
3+
__export__ = css.toString();
4+
5+
export default css;

test/fixtures/import/import-with-layer-and-supports-and-media.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url('./test.css') layer(base);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url('./test.css') layer;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url('./test.css') layer(base) supports(display: grid);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url('./test.css') supports(display: grid) handheld and (max-width: 400px);

0 commit comments

Comments
 (0)