mirror of https://github.com/sveltejs/svelte
fix: add dummy anchor for dynamic component HMR wrappers (#12252)
* add failing test * add dummy anchor for HMR wrappers * lintpull/12246/head
parent
9f51760dc6
commit
9a293ea8c4
@ -0,0 +1 @@
|
||||
<p>hello</p>
|
@ -0,0 +1,21 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true,
|
||||
hmr: true
|
||||
},
|
||||
|
||||
html: `<button>toggle</button>`,
|
||||
|
||||
test({ assert, target }) {
|
||||
const button = target.querySelector('button');
|
||||
|
||||
flushSync(() => button?.click());
|
||||
assert.htmlEqual(target.innerHTML, `<button>toggle</button><p>hello</p>`);
|
||||
|
||||
flushSync(() => button?.click());
|
||||
assert.htmlEqual(target.innerHTML, `<button>toggle</button>`);
|
||||
}
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
let open = $state(false);
|
||||
</script>
|
||||
|
||||
<button onclick={() => (open = !open)}>toggle</button>
|
||||
|
||||
{#if open}
|
||||
<Child />
|
||||
{/if}
|
Loading…
Reference in new issue