mirror of https://github.com/sveltejs/svelte
fix: allow runes for variable declarations in the template (#10879)
parent
852eca4ee6
commit
83f30bf0e8
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: allow runes for variable declarations in the template
|
@ -0,0 +1,19 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<form><input name="name"><button>Add</button></form>`,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`<form><input name="name"><button>Add</button></form><div></div>`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
import { Set } from 'svelte/reactivity';
|
||||||
|
const set = new Set();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form onsubmit={e => {
|
||||||
|
e.preventDefault();
|
||||||
|
const data = new FormData(e.target);
|
||||||
|
const state = $state({ name: data.get('name') });
|
||||||
|
set.add(state);
|
||||||
|
e.target.reset();
|
||||||
|
}}>
|
||||||
|
<input name="name" />
|
||||||
|
<button>Add</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{#each set as item}
|
||||||
|
<div>{item.name}</div>
|
||||||
|
{/each}
|
Loading…
Reference in new issue