mirror of https://github.com/sveltejs/svelte
We were not using the correct node to analyze the if block marker Fixes #17751if-block-hydration-fix
parent
c98ce6945d
commit
a3963f2780
@ -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