add failing test

pull/12252/head
Rich Harris 2 years ago
parent 9f51760dc6
commit 34cbc243d0

@ -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…
Cancel
Save