Skip to content

Commit 709d6fc

Browse files
committed
add test
1 parent b919898 commit 709d6fc

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { test } from '../../assert';
2+
3+
export default test({
4+
mode: ['client'],
5+
async test({ assert, window }) {
6+
// wait the script to load (maybe there a better way)
7+
await new Promise((resolve) => setTimeout(resolve, 1));
8+
assert.htmlEqual(
9+
window.document.body.innerHTML,
10+
`<main><b id="r1">1</b><b id="r2">2</b><b id="r3">3</b></main>`
11+
);
12+
}
13+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script>
2+
function jssrc(src) {
3+
return 'data:text/javascript;base64, ' + btoa(src);
4+
}
5+
6+
const scriptSrcs = [ 1, 2, 3 ]
7+
.map(n => jssrc(`document.getElementById('r${n}').innerText = '${n}';`));
8+
</script>
9+
10+
<svelte:head>
11+
{#each scriptSrcs as src}
12+
<script src={src} async defer></script>
13+
{/each}
14+
</svelte:head>
15+
16+
<b id="r1">?</b><b id="r2">?</b><b id="r3">?</b>

0 commit comments

Comments
 (0)