Skip to content

Commit 16256a3

Browse files
test: escaped in selectors
1 parent f51859b commit 16256a3

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

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

+27
Original file line numberDiff line numberDiff line change
@@ -6355,6 +6355,33 @@ exports.locals = {
63556355
63566356
exports[`modules issue #861: warnings 1`] = `Array []`;
63576357
6358+
exports[`modules issue #966: errors 1`] = `Array []`;
6359+
6360+
exports[`modules issue #966: module (evaluated) 1`] = `
6361+
Array [
6362+
Array [
6363+
1,
6364+
".button.hey {
6365+
color: red;
6366+
}
6367+
",
6368+
"",
6369+
],
6370+
]
6371+
`;
6372+
6373+
exports[`modules issue #966: module 1`] = `
6374+
"exports = module.exports = require(\\"../../../../src/runtime/api.js\\")(false);
6375+
// Module
6376+
exports.push([module.id, \\".button.hey {\\\\n color: red;\\\\n}\\\\n\\", \\"\\"]);
6377+
// Exports
6378+
exports.locals = {
6379+
\\"button\\": \\"button.hey\\"
6380+
};"
6381+
`;
6382+
6383+
exports[`modules issue #966: warnings 1`] = `Array []`;
6384+
63586385
exports[`modules issue #967: errors 1`] = `Array []`;
63596386
63606387
exports[`modules issue #967: module (evaluated) 1`] = `
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.button {
2+
color: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@value btn from './button.css';
2+
3+
.toolbar > btn {
4+
color: red
5+
}

test/modules-option.test.js

+27
Original file line numberDiff line numberDiff line change
@@ -485,4 +485,31 @@ describe('modules', () => {
485485
expect(stats.compilation.warnings).toMatchSnapshot('warnings');
486486
expect(stats.compilation.errors).toMatchSnapshot('errors');
487487
});
488+
489+
it('issue #966', async () => {
490+
const config = {
491+
loader: {
492+
options: {
493+
modules: {
494+
getLocalIdent: (ctx, localIdentName, localName) => {
495+
console.log(localIdentName);
496+
console.log(localName);
497+
return `${localName}.hey`;
498+
},
499+
},
500+
},
501+
},
502+
};
503+
const testId = './modules/issue-966/button.css';
504+
const stats = await webpack(testId, config);
505+
const { modules } = stats.toJson();
506+
const module = modules.find((m) => m.id === testId);
507+
508+
expect(module.source).toMatchSnapshot('module');
509+
expect(evaluated(module.source, modules)).toMatchSnapshot(
510+
'module (evaluated)'
511+
);
512+
expect(stats.compilation.warnings).toMatchSnapshot('warnings');
513+
expect(stats.compilation.errors).toMatchSnapshot('errors');
514+
});
488515
});

0 commit comments

Comments
 (0)