Skip to content

Commit

Permalink
add failing test for #14268
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Nov 12, 2024
1 parent 4a85c41 commit e1cea16
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { flushSync } from 'svelte';
import { test } from '../../test';

export default test({
html: `<button>items: null</button>`,

test({ assert, target }) {
const btn = target.querySelector('button');

flushSync(() => btn?.click());
assert.htmlEqual(target.innerHTML, `<button>items: [0]</button>`);

flushSync(() => btn?.click());
assert.htmlEqual(target.innerHTML, `<button>items: [0,1]</button>`);
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
let items = $state(null);
</script>

<button onclick={() => (items ??= []).push(items.length)}>
items: {JSON.stringify(items)}
</button>

0 comments on commit e1cea16

Please sign in to comment.