Skip to content

Commit c9d8bcc

Browse files
committed
Add test
1 parent 06b308f commit c9d8bcc

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>
2+
let { array } = $props();
3+
</script>
4+
5+
{#each array as number}
6+
<p>{number}</p>
7+
{/each}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
async test({ assert, target }) {
5+
const [b1] = target.querySelectorAll('button');
6+
b1.click();
7+
await Promise.resolve();
8+
9+
assert.htmlEqual(
10+
target.innerHTML,
11+
'<button>add</button><p>1</p><p>2</p><p>3</p><p>4</p><p>0</p>'
12+
);
13+
}
14+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script>
2+
import Child from './Child.svelte';
3+
4+
let array = $state([1,2,3,4]);
5+
6+
const addNew = () => {
7+
array.push(0)
8+
}
9+
</script>
10+
11+
<button onclick={addNew}>add</button>
12+
<Child {array} />
13+

0 commit comments

Comments
 (0)