Skip to content

Commit

Permalink
test: escaped in selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jul 17, 2019
1 parent f51859b commit 90c8446
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/__snapshots__/modules-option.test.js.snap
Expand Up @@ -6355,6 +6355,33 @@ exports.locals = {
exports[`modules issue #861: warnings 1`] = `Array []`;
exports[`modules issue #966: errors 1`] = `Array []`;
exports[`modules issue #966: module (evaluated) 1`] = `
Array [
Array [
1,
".button.hey {
color: red;
}
",
"",
],
]
`;
exports[`modules issue #966: module 1`] = `
"exports = module.exports = require(\\"../../../../src/runtime/api.js\\")(false);
// Module
exports.push([module.id, \\".button.hey {\\\\n color: red;\\\\n}\\\\n\\", \\"\\"]);
// Exports
exports.locals = {
\\"button\\": \\"button.hey\\"
};"
`;
exports[`modules issue #966: warnings 1`] = `Array []`;
exports[`modules issue #967: errors 1`] = `Array []`;
exports[`modules issue #967: module (evaluated) 1`] = `
Expand Down
27 changes: 27 additions & 0 deletions test/modules-option.test.js
Expand Up @@ -485,4 +485,31 @@ describe('modules', () => {
expect(stats.compilation.warnings).toMatchSnapshot('warnings');
expect(stats.compilation.errors).toMatchSnapshot('errors');
});

it('issue #966', async () => {
const config = {
loader: {
options: {
modules: {
getLocalIdent: (ctx, localIdentName, localName) => {
console.log(localIdentName);
console.log(localName);
return `${localName}.hey`;
},
},
},
},
};
const testId = './modules/issue-966/button.css';
const stats = await webpack(testId, config);
const { modules } = stats.toJson();
const module = modules.find((m) => m.id === testId);

expect(module.source).toMatchSnapshot('module');
expect(evaluated(module.source, modules)).toMatchSnapshot(
'module (evaluated)'
);
expect(stats.compilation.warnings).toMatchSnapshot('warnings');
expect(stats.compilation.errors).toMatchSnapshot('errors');
});
});

0 comments on commit 90c8446

Please sign in to comment.