mirror of https://github.com/sveltejs/svelte
update bind:this references when setting to null - fixes #2034
parent
220515b605
commit
17096e6b0e
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
skip_if_ssr: true,
|
||||
|
||||
html: `
|
||||
<div>The text is hello</div>
|
||||
<h1>hello</h1>
|
||||
`,
|
||||
|
||||
test({ assert, component, target }) {
|
||||
component.visible = false;
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<div>The text is missing</div>
|
||||
`);
|
||||
|
||||
component.visible = true;
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<div>The text is hello</div>
|
||||
<h1>hello</h1>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
export let visible = true;
|
||||
let h1;
|
||||
</script>
|
||||
|
||||
<div>The text is {h1 ? h1.textContent : 'missing'}</div>
|
||||
{#if visible}
|
||||
<h1 bind:this={h1}>hello</h1>
|
||||
{/if}
|
Loading…
Reference in new issue