mirror of https://github.com/sveltejs/svelte
fix: hydrate if blocks correctly (#17784)
We were not using the correct node to analyze the if block marker Fixes #17751pull/17788/head
parent
97f3ac5571
commit
fcdc0289db
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: hydrate if blocks correctly
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
import { tick } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
mode: ['hydrate'],
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const e = target.querySelector('#else-branch');
|
||||||
|
|
||||||
|
assert.equal(e?.isConnected, true);
|
||||||
|
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
assert.equal(e?.isConnected, true);
|
||||||
|
assert.htmlEqual(target.innerHTML, '<p id="else-branch">else branch</p>');
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
{#if await false}
|
||||||
|
<p id="if-branch">if branch</p>
|
||||||
|
{:else}
|
||||||
|
<p id="else-branch">{await 'else branch'}</p>
|
||||||
|
{/if}
|
||||||
Loading…
Reference in new issue