Skip to content

Commit 796fe28

Browse files
Test more (#1024)
* test: more * test: more * test: more * test: more * test: more
1 parent d358cdb commit 796fe28

11 files changed

+449
-22
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Array [
4444
],
4545
Array [
4646
"../../src/index.js?[ident]!./import/order-2.css",
47-
".order-1 {
47+
".order-2 {
4848
color: red;
4949
}
5050
",
@@ -68,7 +68,7 @@ Array [
6868
],
6969
Array [
7070
"../../src/index.js?[ident]!./import/order-2.css",
71-
".order-1 {
71+
".order-2 {
7272
color: red;
7373
}
7474
",

test/__snapshots__/loader.test.js.snap

+173
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,179 @@ You may need an appropriate loader to handle this file type, currently no loader
115115

116116
exports[`loader should throws error when no loader(s) for assets: warnings 1`] = `Array []`;
117117

118+
exports[`loader should work with "asset" module type: errors 1`] = `Array []`;
119+
120+
exports[`loader should work with "asset" module type: module 1`] = `
121+
"// Imports
122+
var ___CSS_LOADER_API_IMPORT___ = require(\\"../../src/runtime/api.js\\");
123+
var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../src/index.js!./imported.css\\");
124+
var ___CSS_LOADER_GET_URL_IMPORT___ = require(\\"../../src/runtime/getUrl.js\\");
125+
var ___CSS_LOADER_URL_IMPORT_0___ = require(\\"./url/img.png\\");
126+
exports = ___CSS_LOADER_API_IMPORT___(false);
127+
exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
128+
var ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_0___);
129+
// Module
130+
exports.push([module.id, \\"@charset \\\\\\"UTF-8\\\\\\";\\\\n\\\\n/* Comment */\\\\n\\\\n.class {\\\\n color: red;\\\\n background: url(\\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \\");\\\\n}\\\\n\\\\n.class-duplicate-url {\\\\n background: url(\\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \\");\\\\n}\\\\n\\\\n:root {\\\\n --foo: 1px;\\\\n --bar: 2px;\\\\n}\\\\n\\\\n.class { a: b c d; }\\\\n\\\\n.two {}\\\\n\\\\n.u-m\\\\\\\\+ { a: b c d; }\\\\n\\\\n.class { content: \\\\\\"\\\\\\\\F10C\\\\\\" }\\\\n\\\\n@media only screen and (max-width: 600px) {\\\\n body {\\\\n background-color: lightblue;\\\\n }\\\\n}\\\\n\\\\n.class {\\\\n content: \\\\\\"\\\\\\\\2193\\\\\\";\\\\n content: \\\\\\"\\\\\\\\2193\\\\\\\\2193\\\\\\";\\\\n content: \\\\\\"\\\\\\\\2193 \\\\\\\\2193\\\\\\";\\\\n content: \\\\\\"\\\\\\\\2193\\\\\\\\2193\\\\\\\\2193\\\\\\";\\\\n content: \\\\\\"\\\\\\\\2193 \\\\\\\\2193 \\\\\\\\2193\\\\\\";\\\\n}\\\\n\\\\n.-top {}\\\\n.\\\\\\\\-top {}\\\\n\\\\n#\\\\\\\\#test {}\\\\n\\\\n.grid {\\\\n display: flex;\\\\n flex-wrap: wrap;\\\\n}\\\\n.grid.\\\\\\\\-top {\\\\n align-items: flex-start;\\\\n}\\\\n.grid.-top {\\\\n align-items: flex-start;\\\\n}\\\\n.grid.\\\\\\\\-middle {\\\\n align-items: center;\\\\n}\\\\n.grid.\\\\\\\\-bottom {\\\\n align-items: flex-end;\\\\n}\\\\n\\\\n.u-m\\\\\\\\00002b {}\\\\n\\\\n.u-m00002b {}\\\\n\\\\n#u-m\\\\\\\\+ {}\\\\n\\\\nbody {\\\\n font-family: '微软雅黑'; /* some chinese font name */\\\\n}\\\\n\\\\n.myStyle {\\\\n content: '\\\\\\\\e901';\\\\n}\\\\n\\\\n.myStyle {\\\\n content: '\\\\\\\\E901';\\\\n}\\\\n\\\\n.♫ {}\\\\n\\\\n.\\\\\\\\3A \\\\\\\\\`\\\\\\\\( {} /* matches elements with class=\\\\\\":\`(\\\\\\" */\\\\n.\\\\\\\\31 a2b3c {} /* matches elements with class=\\\\\\"1a2b3c\\\\\\" */\\\\n#\\\\\\\\#fake-id {} /* matches the element with id=\\\\\\"#fake-id\\\\\\" */\\\\n#-a-b-c- {} /* matches the element with id=\\\\\\"-a-b-c-\\\\\\" */\\\\n#© {} /* matches the element with id=\\\\\\"©\\\\\\" */\\\\n\\\\n:root {\\\\n --title-align: center;\\\\n --sr-only: {\\\\n position: absolute;\\\\n width: 1px;\\\\n height: 1px;\\\\n padding: 0;\\\\n overflow: hidden;\\\\n clip: rect(0,0,0,0);\\\\n white-space: nowrap;\\\\n clip-path: inset(50%);\\\\n border: 0;\\\\n };\\\\n}\\\\n\\\\n.test {\\\\n content: \\\\\\"\\\\\\\\2014\\\\\\\\A0\\\\\\";\\\\n content: \\\\\\"\\\\\\\\2014 \\\\\\\\A0\\\\\\";\\\\n content: \\\\\\"\\\\\\\\A0 \\\\\\\\2014\\\\\\";\\\\n content: \\\\\\"\\\\\\\\A0\\\\\\\\2014\\\\\\";\\\\n margin-top: 1px\\\\\\\\9;\\\\n background-color: #000\\\\\\\\9;\\\\n}\\\\n\\\\n.light.on .bulb:before{\\\\n content: '💡';\\\\n}\\\\n\\\\n.base64 {\\\\n background: url(data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAhxJREFUSA3tk71rU1EYxnMTEoJUkowWwdJ2akEHBfGjCiIF6ZylVUKSm2TqZLGI+A/oIu2UXm8C4lAyF4SWji0tdFLo1Eo7VN0SaBEhH7e/Nz0nPTfGOjiaCyfPc5734zlfCQT6X/8E/vUErL81KBaL9y3LSnued5PcITjUOwR3gsFg2bbtjYt6/NGgXC4P1et1l2aPLmpAbD0SidjpdPqgV15PA9d17zQajU8UxHQRK/4G35Q5pveAK8LlI1ZjPMnlcltnyvnvbwaO41xvtVqy7YHztMACq5xnlb9EY3dRdvcGo1kj5wR+t1AofDG0gM+A875E8DNjRCexsrV8Pj9ZqVQitVrtqejxePxjMpmss5hVTB4buXvMb2DyU2tBTRS+BjvNlVYUpPl7iuVO3Gq1uoQx1FtSOW1gPgp5ZWrdBtNmUDgv5asgxQ8F1af5vhY0YjyjuWC3wTszKJz7GBOkcFlQfW2ONq4FjWi+Hj6DRCKxQOK2TlY4x92EuYd5dvMAbYIzfikau3pu5tJ8KxaLLfo0cyKci7tK4TZjUMcoXAmHwzle0Q/RaC5P1GFMyVx9R9Fo9HYqlTrSgqDvFelAqVQa5hmuMR/WGtjAaBdjwBoDQ0ZsnwVMZjKZ9n0Zem8DSeDPdrnZbL6F2l3NOvUYNZk4oVDoRTabPe4EDNJzB0ZcjAYxeoZ2i3FNxQ7BHYw/cB/fldaH//UETgHHO8S44KbfXgAAAABJRU5ErkJggg==);\\\\n}\\\\n\\\\na[href=''] {\\\\n color: red;\\\\n}\\\\n\\\\na[href='' i] {\\\\n color: red;\\\\n}\\\\n\\\\na[href=\\\\\\"\\\\\\"] {\\\\n color: blue;\\\\n}\\\\n\\\\na[href=\\\\\\"\\\\\\" i] {\\\\n color: blue;\\\\n}\\\\n\\", \\"\\"]);
131+
// Exports
132+
module.exports = exports;
133+
"
134+
`;
135+
136+
exports[`loader should work with "asset" module type: result 1`] = `
137+
Array [
138+
Array [
139+
"../../src/index.js!./imported.css",
140+
".foo {
141+
color: red;
142+
}
143+
",
144+
"",
145+
],
146+
Array [
147+
"./basic.css",
148+
"@charset \\"UTF-8\\";
149+
150+
/* Comment */
151+
152+
.class {
153+
color: red;
154+
background: url(/webpack/public/path/img.png);
155+
}
156+
157+
.class-duplicate-url {
158+
background: url(/webpack/public/path/img.png);
159+
}
160+
161+
:root {
162+
--foo: 1px;
163+
--bar: 2px;
164+
}
165+
166+
.class { a: b c d; }
167+
168+
.two {}
169+
170+
.u-m\\\\+ { a: b c d; }
171+
172+
.class { content: \\"\\\\F10C\\" }
173+
174+
@media only screen and (max-width: 600px) {
175+
body {
176+
background-color: lightblue;
177+
}
178+
}
179+
180+
.class {
181+
content: \\"\\\\2193\\";
182+
content: \\"\\\\2193\\\\2193\\";
183+
content: \\"\\\\2193 \\\\2193\\";
184+
content: \\"\\\\2193\\\\2193\\\\2193\\";
185+
content: \\"\\\\2193 \\\\2193 \\\\2193\\";
186+
}
187+
188+
.-top {}
189+
.\\\\-top {}
190+
191+
#\\\\#test {}
192+
193+
.grid {
194+
display: flex;
195+
flex-wrap: wrap;
196+
}
197+
.grid.\\\\-top {
198+
align-items: flex-start;
199+
}
200+
.grid.-top {
201+
align-items: flex-start;
202+
}
203+
.grid.\\\\-middle {
204+
align-items: center;
205+
}
206+
.grid.\\\\-bottom {
207+
align-items: flex-end;
208+
}
209+
210+
.u-m\\\\00002b {}
211+
212+
.u-m00002b {}
213+
214+
#u-m\\\\+ {}
215+
216+
body {
217+
font-family: '微软雅黑'; /* some chinese font name */
218+
}
219+
220+
.myStyle {
221+
content: '\\\\e901';
222+
}
223+
224+
.myStyle {
225+
content: '\\\\E901';
226+
}
227+
228+
.♫ {}
229+
230+
.\\\\3A \\\\\`\\\\( {} /* matches elements with class=\\":\`(\\" */
231+
.\\\\31 a2b3c {} /* matches elements with class=\\"1a2b3c\\" */
232+
#\\\\#fake-id {} /* matches the element with id=\\"#fake-id\\" */
233+
#-a-b-c- {} /* matches the element with id=\\"-a-b-c-\\" */
234+
{} /* matches the element with id=\\\\" */
235+
236+
:root {
237+
--title-align: center;
238+
--sr-only: {
239+
position: absolute;
240+
width: 1px;
241+
height: 1px;
242+
padding: 0;
243+
overflow: hidden;
244+
clip: rect(0,0,0,0);
245+
white-space: nowrap;
246+
clip-path: inset(50%);
247+
border: 0;
248+
};
249+
}
250+
251+
.test {
252+
content: \\"\\\\2014\\\\A0\\";
253+
content: \\"\\\\2014 \\\\A0\\";
254+
content: \\"\\\\A0 \\\\2014\\";
255+
content: \\"\\\\A0\\\\2014\\";
256+
margin-top: 1px\\\\9;
257+
background-color: #000\\\\9;
258+
}
259+
260+
.light.on .bulb:before{
261+
content: '💡';
262+
}
263+
264+
.base64 {
265+
background: url(data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAhxJREFUSA3tk71rU1EYxnMTEoJUkowWwdJ2akEHBfGjCiIF6ZylVUKSm2TqZLGI+A/oIu2UXm8C4lAyF4SWji0tdFLo1Eo7VN0SaBEhH7e/Nz0nPTfGOjiaCyfPc5734zlfCQT6X/8E/vUErL81KBaL9y3LSnued5PcITjUOwR3gsFg2bbtjYt6/NGgXC4P1et1l2aPLmpAbD0SidjpdPqgV15PA9d17zQajU8UxHQRK/4G35Q5pveAK8LlI1ZjPMnlcltnyvnvbwaO41xvtVqy7YHztMACq5xnlb9EY3dRdvcGo1kj5wR+t1AofDG0gM+A875E8DNjRCexsrV8Pj9ZqVQitVrtqejxePxjMpmss5hVTB4buXvMb2DyU2tBTRS+BjvNlVYUpPl7iuVO3Gq1uoQx1FtSOW1gPgp5ZWrdBtNmUDgv5asgxQ8F1af5vhY0YjyjuWC3wTszKJz7GBOkcFlQfW2ONq4FjWi+Hj6DRCKxQOK2TlY4x92EuYd5dvMAbYIzfikau3pu5tJ8KxaLLfo0cyKci7tK4TZjUMcoXAmHwzle0Q/RaC5P1GFMyVx9R9Fo9HYqlTrSgqDvFelAqVQa5hmuMR/WGtjAaBdjwBoDQ0ZsnwVMZjKZ9n0Zem8DSeDPdrnZbL6F2l3NOvUYNZk4oVDoRTabPe4EDNJzB0ZcjAYxeoZ2i3FNxQ7BHYw/cB/fldaH//UETgHHO8S44KbfXgAAAABJRU5ErkJggg==);
266+
}
267+
268+
a[href=''] {
269+
color: red;
270+
}
271+
272+
a[href='' i] {
273+
color: red;
274+
}
275+
276+
a[href=\\"\\"] {
277+
color: blue;
278+
}
279+
280+
a[href=\\"\\" i] {
281+
color: blue;
282+
}
283+
",
284+
"",
285+
],
286+
]
287+
`;
288+
289+
exports[`loader should work with "asset" module type: warnings 1`] = `Array []`;
290+
118291
exports[`loader should work with "sass-loader": errors 1`] = `Array []`;
119292
120293
exports[`loader should work with "sass-loader": module 1`] = `

0 commit comments

Comments
 (0)