Skip to content

Commit 60c6f1d

Browse files
test: invisible space (#234)
1 parent c34f0ae commit 60c6f1d

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

test/__snapshots__/loader.test.js.snap

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`loader should not failed contain invisible spaces: errors 1`] = `Array []`;
4+
5+
exports[`loader should not failed contain invisible spaces: module 1`] = `
6+
"// Exports
7+
module.exports = \\"<ul>\\\\n <li> \\\\\\\\u2028 - 
 </li>\\\\n <li> \\\\\\\\u2029 - 
 </li>\\\\n</ul>\\\\n\\";"
8+
`;
9+
10+
exports[`loader should not failed contain invisible spaces: result 1`] = `
11+
"<ul>
12+
<li> \\\\u2028 - 
 </li>
13+
<li> \\\\u2029 - 
 </li>
14+
</ul>
15+
"
16+
`;
17+
18+
exports[`loader should not failed contain invisible spaces: warnings 1`] = `Array []`;
19+
320
exports[`loader should not make bad things with templates: errors 1`] = `Array []`;
421

522
exports[`loader should not make bad things with templates: module 1`] = `

test/fixtures/invisible-space.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<ul>
2+
<li> \u2028 - 
 </li>
3+
<li> \u2029 - 
 </li>
4+
</ul>

test/fixtures/invisible-space.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import html from './invisible-space.html';
2+
3+
export default html;

test/loader.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,18 @@ describe('loader', () => {
3232
expect(getWarnings(stats)).toMatchSnapshot('warnings');
3333
expect(getErrors(stats)).toMatchSnapshot('errors');
3434
});
35+
36+
it('should not failed contain invisible spaces', async () => {
37+
const compiler = getCompiler('invisible-space.js');
38+
const stats = await compile(compiler);
39+
40+
expect(getModuleSource('./invisible-space.html', stats)).toMatchSnapshot(
41+
'module'
42+
);
43+
expect(
44+
execute(readAsset('main.bundle.js', compiler, stats))
45+
).toMatchSnapshot('result');
46+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
47+
expect(getErrors(stats)).toMatchSnapshot('errors');
48+
});
3549
});

0 commit comments

Comments
 (0)