Add yet another test case

pull/16150/head
Matei-Paul Trandafir 3 months ago
parent 92d2b1f1e3
commit 373ca3faef
No known key found for this signature in database
GPG Key ID: BC96CA77836E14F8

@ -0,0 +1,7 @@
<script>
let { value } = $props()
const text = $derived(value.toString())
$effect(() => console.log(text))
</script>

@ -2,15 +2,16 @@ import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
async test({ assert, target }) {
async test({ assert, target, logs }) {
const [btn1, btn2] = target.querySelectorAll('button');
const [div] = target.querySelectorAll('div');
flushSync(() => btn1?.click());
assert.htmlEqual(div.innerHTML, '123 <br> 123');
assert.htmlEqual(div.innerHTML, '123 123');
assert.equal(div.inert, true);
flushSync(() => btn2?.click());
assert.htmlEqual(div.innerHTML, '');
assert.deepEqual(logs, ['123']);
}
});

@ -1,4 +1,6 @@
<script>
import Component from './Component.svelte';
let outer = $state(true);
let inner = $state(123);
@ -11,9 +13,8 @@
<div out:outro>
{#if inner}
{@const text = inner.toString()}
{text}
<br>
{inner.toString()}
{text} {inner.toString()}
<Component value={inner} />
{/if}
</div>
{/if}

Loading…
Cancel
Save