mirror of https://github.com/sveltejs/svelte
parent
41e7dab755
commit
56b71665b5
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: better handling of empty text node hydration
|
||||
@ -0,0 +1,12 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<button></button>`,
|
||||
|
||||
async test({ assert, target }) {
|
||||
const btn = target.querySelector('button');
|
||||
|
||||
await btn?.click();
|
||||
assert.htmlEqual(target.innerHTML, `<button>foo</button>`);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let foo = $state();
|
||||
</script>
|
||||
|
||||
<button on:click={() => foo = 'foo'}>{foo}</button>
|
||||
@ -1,12 +1,15 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<button></button>`,
|
||||
html: `<button type="button">Update Text</button><div></div>`,
|
||||
|
||||
async test({ assert, target }) {
|
||||
const btn = target.querySelector('button');
|
||||
|
||||
await btn?.click();
|
||||
assert.htmlEqual(target.innerHTML, `<button>foo</button>`);
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`<button type="button">Update Text</button><div>updated</div>`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
<script>
|
||||
let foo = $state();
|
||||
let text = $state('');
|
||||
|
||||
function update_text() {
|
||||
text = 'updated';
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={() => foo = 'foo'}>{foo}</button>
|
||||
<button type="button" on:click={update_text}>Update Text</button>
|
||||
|
||||
<div>{text}</div>
|
||||
|
||||
Loading…
Reference in new issue