mirror of https://github.com/sveltejs/svelte
parent
f0497b15ee
commit
90fa12fea3
@ -0,0 +1,16 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const [btn1, btn2] = target.querySelectorAll('button');
|
||||||
|
const [div] = target.querySelectorAll('div');
|
||||||
|
|
||||||
|
flushSync(() => btn1?.click());
|
||||||
|
assert.htmlEqual(div.innerHTML, '123');
|
||||||
|
assert.equal(div.inert, true);
|
||||||
|
|
||||||
|
flushSync(() => btn2?.click());
|
||||||
|
assert.htmlEqual(div.innerHTML, '123');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
let outer = $state(true);
|
||||||
|
let inner = $state(123);
|
||||||
|
|
||||||
|
function outro() {
|
||||||
|
return { duration: 100 };
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if outer}
|
||||||
|
<div out:outro>
|
||||||
|
{#if inner}
|
||||||
|
{inner.toString()}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<button onclick={() => { outer = false; inner = undefined; }}>Set both to falsy</button>
|
||||||
|
<button onclick={() => { outer = true }}>Set outer to truthy</button>
|
Loading…
Reference in new issue