Skip to content

Commit fcddd56

Browse files
wip(tests): test script/style/template src attribute
1 parent d94144f commit fcddd56

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/basic.test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,52 @@ const { defaultFilesVue2, defaultFiles, createPage } = require('./testsTools.js'
603603
});
604604

605605

606+
607+
test.only('should handle src attribute', async () => {
608+
609+
const { page, output } = await createPage({
610+
files: {
611+
...files,
612+
613+
'/template.html': `
614+
<span class="test">
615+
Hello {{ abc }} !
616+
</span>
617+
`,
618+
619+
'/styles.css': `
620+
.test {
621+
color: red
622+
}
623+
`,
624+
625+
'/script.js': `
626+
export default {
627+
data() {
628+
return {
629+
abc: "World"
630+
}
631+
}
632+
}
633+
`,
634+
635+
'/component.vue': `
636+
<template src='./template.html'></template>
637+
<style scoped src='./styles.css'></style>
638+
<script src="./script.js"></script>
639+
`
640+
}
641+
});
642+
643+
await expect(page.$eval('#app', el => el.textContent.trim())).resolves.toBe('Hello World !');
644+
await expect(page.$eval('#app .test', el => JSON.parse(JSON.stringify(getComputedStyle(el))))).resolves.toMatchObject( { color: 'rgb(255, 0, 0)' } );
645+
646+
await page.close();
647+
});
648+
649+
650+
651+
606652
});
607653

608654

0 commit comments

Comments
 (0)