Skip to content

Commit

Permalink
test: more
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Oct 7, 2021
1 parent b29d389 commit a56bd94
Show file tree
Hide file tree
Showing 7 changed files with 2,500 additions and 6,571 deletions.
8,780 changes: 2,237 additions & 6,543 deletions package-lock.json

Large diffs are not rendered by default.

108 changes: 104 additions & 4 deletions test/__snapshots__/modules-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5059,6 +5059,86 @@ Array [

exports[`"modules" option should work when the "namedExport" is enabled and the "exportLocalsConvention" options has "dashesOnly" value: warnings 1`] = `Array []`;

exports[`"modules" option should work when the 'auto' is not specified with inline module syntax: errors 1`] = `Array []`;

exports[`"modules" option should work when the 'auto' is not specified with inline module syntax: module 1 1`] = `
"// Imports
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../src/runtime/noSourceMaps.js\\";
import ___CSS_LOADER_API_IMPORT___ from \\"../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n}\\\\n\\\\n.blue {\\\\n color: white;\\\\n}\\\\n\\\\n.class { from: custom; }\\", \\"\\"]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
`;

exports[`"modules" option should work when the 'auto' is not specified with inline module syntax: module 2 1`] = `
"// Imports
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../src/runtime/noSourceMaps.js\\";
import ___CSS_LOADER_API_IMPORT___ from \\"../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".tAbfDoQYh1hH8fgy5jt_ {\\\\n color: red;\\\\n}\\\\n\\\\n._h7REYQFFxfq7wKBe15e { from: custom; }\\", \\"\\"]);
// Exports
___CSS_LOADER_EXPORT___.locals = {
\\"some-class\\": \\"tAbfDoQYh1hH8fgy5jt_\\",
\\"class\\": \\"_h7REYQFFxfq7wKBe15e\\"
};
export default ___CSS_LOADER_EXPORT___;
"
`;

exports[`"modules" option should work when the 'auto' is not specified with inline module syntax: module 3 1`] = `
"// Imports
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../src/runtime/noSourceMaps.js\\";
import ___CSS_LOADER_API_IMPORT___ from \\"../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".some-class {\\\\n color: red;\\\\n}\\\\n\\\\n.class { from: custom; }\\", \\"\\"]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
`;

exports[`"modules" option should work when the 'auto' is not specified with inline module syntax: result 1`] = `
Array [
Array [
"other.css!=!./my-inline-loader/index.js!./index-loader-syntax.modules.css",
".foo {
color: red;
}

.blue {
color: white;
}

.class { from: custom; }",
"",
],
Array [
"other.modules.css!=!./my-inline-loader/index.js!./simple.css",
".tAbfDoQYh1hH8fgy5jt_ {
color: red;
}

._h7REYQFFxfq7wKBe15e { from: custom; }",
"",
],
Array [
"other.css!=!./my-inline-loader/index.js!./simple-1.css",
".some-class {
color: red;
}

.class { from: custom; }",
"",
],
]
`;

exports[`"modules" option should work when the 'auto' is not specified with inline module syntax: warnings 1`] = `Array []`;

exports[`"modules" option should work with "exportOnlyLocals" and "esModule" with "false" value options: errors 1`] = `Array []`;

exports[`"modules" option should work with "exportOnlyLocals" and "esModule" with "false" value options: module 1`] = `
Expand Down Expand Up @@ -5414,9 +5494,9 @@ Object {

exports[`"modules" option should work with "exportOnlyLocals" and "namedExport" option: warnings 1`] = `Array []`;

exports[`"modules" option should work with "false" alises: errors 1`] = `Array []`;
exports[`"modules" option should work with "false" aliases: errors 1`] = `Array []`;

exports[`"modules" option should work with "false" alises: module 1`] = `
exports[`"modules" option should work with "false" aliases: module 1`] = `
"// Imports
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../../../src/runtime/noSourceMaps.js\\";
import ___CSS_LOADER_API_IMPORT___ from \\"../../../../src/runtime/api.js\\";
Expand All @@ -5431,7 +5511,7 @@ export default ___CSS_LOADER_EXPORT___;
"
`;

exports[`"modules" option should work with "false" alises: result 1`] = `
exports[`"modules" option should work with "false" aliases: result 1`] = `
Array [
Array [
"./modules/icss-false-alias/relative.icss.css",
Expand All @@ -5444,7 +5524,7 @@ Array [
]
`;

exports[`"modules" option should work with "false" alises: warnings 1`] = `Array []`;
exports[`"modules" option should work with "false" aliases: warnings 1`] = `Array []`;

exports[`"modules" option should work with "url" and "namedExport": errors 1`] = `Array []`;

Expand Down Expand Up @@ -15107,6 +15187,26 @@ Array [

exports[`"modules" option should work with the "namedExport" option: warnings 1`] = `Array []`;

exports[`"modules" option should work with the 'auto' and exctract CSS using mini-css-extract-plugin: css 1`] = `
"/*!*****************************************************************!*\\\\
!*** css ../../src/index.js!./modules/mode/relative.module.css ***!
\\\\*****************************************************************/
.IU1H9vP4cpzQT_RvUQ84 {
color: red;
}

"
`;

exports[`"modules" option should work with the 'auto' and exctract CSS using mini-css-extract-plugin: errors 1`] = `Array []`;

exports[`"modules" option should work with the 'auto' and exctract CSS using mini-css-extract-plugin: module 1`] = `
"// extracted by mini-css-extract-plugin
export default {\\"relative\\":\\"IU1H9vP4cpzQT_RvUQ84\\"};"
`;

exports[`"modules" option should work with the 'auto' and exctract CSS using mini-css-extract-plugin: warnings 1`] = `Array []`;

exports[`"modules" option should work with the \`exportGlobals\` option (the \`mode\` option is \`global\`): errors 1`] = `Array []`;

exports[`"modules" option should work with the \`exportGlobals\` option (the \`mode\` option is \`global\`): module 1`] = `
Expand Down
110 changes: 88 additions & 22 deletions test/__snapshots__/url-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2588,11 +2588,11 @@ exports[`"url" option should work with mini-css-extract-plugin: css 1`] = `
}

.class {
background: green url( \\"/webpack/public/path/img img.png\\" ) xyz;
background: green url( \\"/webpack/public/path/img%20img.png\\" ) xyz;
}

.class {
background: green url( \\"/webpack/public/path/img img.png\\" ) xyz;
background: green url( \\"/webpack/public/path/img%20img.png\\" ) xyz;
}

.class {
Expand Down Expand Up @@ -2632,11 +2632,11 @@ exports[`"url" option should work with mini-css-extract-plugin: css 1`] = `
url(/webpack/public/path/font.woff2) format('woff2'),
url(/webpack/public/path/font.eot) format('eot'),
url(/webpack/public/path/font.ttf) format('truetype'),
url(\\"/webpack/public/path/font with spaces.eot\\") format(\\"embedded-opentype\\"),
url(\\"/webpack/public/path/font%20with%20spaces.eot\\") format(\\"embedded-opentype\\"),
url(/webpack/public/path/font.svg#svgFontName) format('svg'),
url(/webpack/public/path/font.woff2) format('woff2'),
url(/webpack/public/path/font.eot?#iefix) format('embedded-opentype'),
url(\\"/webpack/public/path/font with spaces.eot?#iefix\\") format('embedded-opentype');
url(\\"/webpack/public/path/font%20with%20spaces.eot?#iefix\\") format('embedded-opentype');
}

@media (min-width: 500px) {
Expand Down Expand Up @@ -2785,7 +2785,7 @@ a {
background-image: -webkit-image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x);
background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x);
background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x);
background-image: image-set(\\"/webpack/public/path/img img.png\\" 1x, \\"/webpack/public/path/img img.png\\" 2x);
background-image: image-set(\\"/webpack/public/path/img%20img.png\\" 1x, \\"/webpack/public/path/img%20img.png\\" 2x);
background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x),
image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x);
background-image: image-set(
Expand Down Expand Up @@ -2813,7 +2813,7 @@ a {
url(/webpack/public/path/img2x.png) 2x,
url(/webpack/public/path/img3x.png) 600dpi
);
background-image: image-set(url(\\"/webpack/public/path/img img.png\\") 1x, url(\\"/webpack/public/path/img img.png\\") 2x);
background-image: image-set(url(\\"/webpack/public/path/img%20img.png\\") 1x, url(\\"/webpack/public/path/img%20img.png\\") 2x);

background-image: image-set(url(/webpack/public/path/img1x.png) 1x, \\"/webpack/public/path/img2x.png\\" 2x);
}
Expand All @@ -2825,8 +2825,8 @@ a {
background: url(\\"/webpack/public/path/img'''img.png\\");
background: url(\\"/webpack/public/path/img(img.png\\");
background: url(\\"/webpack/public/path/img)img.png\\");
background: url(\\"/webpack/public/path/img img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img%20img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");

background-image: image-set(
/* Not allowed on windows */
Expand All @@ -2835,19 +2835,19 @@ a {
url(\\"/webpack/public/path/img'img.png\\") 3x,
url(\\"/webpack/public/path/img(img.png\\") 4x,
url(\\"/webpack/public/path/img)img.png\\") 5x,
url(\\"/webpack/public/path/img img.png\\") 6x,
url(\\"/webpack/public/path/img'() img.png\\") 7x
url(\\"/webpack/public/path/img%20img.png\\") 6x,
url(\\"/webpack/public/path/img'()%20img.png\\") 7x
);
}

.class-class-class {
background: url(\\"/webpack/public/path/img'''img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");
background: url(\\"/webpack/public/path/img'img.png\\");
background: url(\\"/webpack/public/path/img(img.png\\");
background: url(\\"/webpack/public/path/img)img.png\\");
background: url(\\"/webpack/public/path/img img.png\\");
background: url(\\"/webpack/public/path/img img.png\\");
background: url(\\"/webpack/public/path/img%20img.png\\");
background: url(\\"/webpack/public/path/img%20img.png\\");
}

/* Comment */
Expand All @@ -2861,17 +2861,17 @@ a {

.other-test-case {
background: url(\\"/webpack/public/path/img'''img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");
background: url(\\"/webpack/public/path/img'img.png\\");
background: url(\\"/webpack/public/path/img(img.png\\");
background: url(\\"/webpack/public/path/img)img.png\\");
background: url(\\"/webpack/public/path/img img.png\\");
background: url(\\"/webpack/public/path/img%20img.png\\");
background: url(\\"/webpack/public/path/img'''img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");
background: url(\\"/webpack/public/path/img'img.png\\");
background: url(\\"/webpack/public/path/img(img.png\\");
background: url(\\"/webpack/public/path/img)img.png\\");
background: url(\\"/webpack/public/path/img img.png\\");
background: url(\\"/webpack/public/path/img%20img.png\\");
}

.qqq {
Expand All @@ -2880,16 +2880,16 @@ a {

.www {
background: url(\\"/webpack/public/path/img'''img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");
background: url(\\"/webpack/public/path/img'img.png\\");
background: url(\\"/webpack/public/path/img(img.png\\");
background: url(\\"/webpack/public/path/img)img.png\\");
background: url(\\"/webpack/public/path/img img.png\\");
background: url(\\"/webpack/public/path/img%20img.png\\");
background: url(/webpack/public/path/img.png);
background: url(/webpack/public/path/img.png);
background: url(\\"/webpack/public/path/img'img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img'() img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");
background: url(\\"/webpack/public/path/img'()%20img.png\\");
}

.class {
Expand Down Expand Up @@ -2977,7 +2977,73 @@ exports[`"url" option should work with mini-css-extract-plugin: module 1`] = `
export {};"
`;

exports[`"url" option should work with mini-css-extract-plugin: warnings 1`] = `Array []`;
exports[`"url" option should work with mini-css-extract-plugin: warnings 1`] = `
Array [
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(120:3) Unable to find uri in 'background: green url() xyz'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(124:3) Unable to find uri in 'background: green url('') xyz'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(132:3) Unable to find uri in 'background: green url(' ') xyz'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(136:3) Unable to find uri in 'background: green url(
) xyz'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(218:3) Unable to find uri in 'background-image: image-set('')'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(221:3) Unable to find uri in 'background-image: image-set(url())'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(222:3) Unable to find uri in 'background-image: image-set(
url()
)'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(225:3) Unable to find uri in 'background-image: image-set(URL())'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(226:3) Unable to find uri in 'background-image: image-set(url(''))'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'",
]
`;

exports[`"url" option should work with the 'asset' type of asset modules: errors 1`] = `Array []`;

Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/index-loader-syntax-left-and-right.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import one from 'other.css!=!./my-inline-loader!./index-loader-syntax.modules.css';
import two from 'other.modules.css!=!./my-inline-loader!./simple.css';
import three from 'other.css!=!./my-inline-loader!./simple-1.css';

__export__ = [...one, ...two, ...three];

export default [...one, ...two, ...three];
3 changes: 3 additions & 0 deletions test/fixtures/simple-1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.some-class {
color: red;
}
Loading

0 comments on commit a56bd94

Please sign in to comment.