Skip to content

Commit 5d2c52e

Browse files
test: escaped in selectors (#973)
1 parent f51859b commit 5d2c52e

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-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

+24
Original file line numberDiff line numberDiff line change
@@ -485,4 +485,28 @@ 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+
`${localName}.hey`,
496+
},
497+
},
498+
},
499+
};
500+
const testId = './modules/issue-966/button.css';
501+
const stats = await webpack(testId, config);
502+
const { modules } = stats.toJson();
503+
const module = modules.find((m) => m.id === testId);
504+
505+
expect(module.source).toMatchSnapshot('module');
506+
expect(evaluated(module.source, modules)).toMatchSnapshot(
507+
'module (evaluated)'
508+
);
509+
expect(stats.compilation.warnings).toMatchSnapshot('warnings');
510+
expect(stats.compilation.errors).toMatchSnapshot('errors');
511+
});
488512
});

0 commit comments

Comments
 (0)