-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a85c41
commit e1cea16
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/svelte/tests/runtime-runes/samples/proxy-nullish-coalescing-assignment/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>`); | ||
} | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/runtime-runes/samples/proxy-nullish-coalescing-assignment/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |