Skip to content

Commit b7bf669

Browse files
wip(tests): test include svg image in template
1 parent 706d065 commit b7bf669

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/basic.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,40 @@ const { defaultFilesVue2, defaultFiles, createPage } = require('./testsTools.js'
648648

649649

650650

651+
test('should properly include svg image', async () => {
652+
653+
654+
const { page, output } = await createPage({
655+
files: {
656+
...files,
657+
658+
'/image.svg': `
659+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 80">
660+
<text y="75" font-size="100" font-family="serif"><![CDATA[10]]></text>
661+
</svg>
662+
`.trim(),
663+
664+
'/component.vue': `
665+
<template>
666+
<img :src="require('./image.svg')">
667+
</template>
668+
`,
669+
'/optionsOverride.js': `
670+
export default (options) => {
671+
672+
options.additionalModuleHandlers = {
673+
'.svg': (source, path, options) => 'data:image/svg+xml,' + source,
674+
};
675+
};
676+
`,
677+
}
678+
});
679+
680+
await expect(page.$eval('#app', el => el.innerHTML)).resolves.toMatch(/.*[CDATA[10]].*/);
681+
await page.close();
682+
});
683+
684+
651685

652686
});
653687

0 commit comments

Comments
 (0)