mirror of https://github.com/sveltejs/svelte
commit
4e847cfd14
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: take into account static blocks when determining transition locality
|
||||
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: flush pending changes after rendering `failed` snippet
|
||||
@ -0,0 +1,12 @@
|
||||
import { tick } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target, logs }) {
|
||||
const btn = target.querySelector('button');
|
||||
btn?.click();
|
||||
await tick();
|
||||
|
||||
assert.deepEqual(logs, ['attachment']);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,20 @@
|
||||
<script>
|
||||
let fail = $state(false);
|
||||
|
||||
function error() {
|
||||
throw new Error('oops');
|
||||
}
|
||||
|
||||
function attachment() {
|
||||
console.log('attachment');
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:boundary>
|
||||
{fail ? error() : 'all good'}
|
||||
<button onclick={() => fail = true}>fail</button>
|
||||
|
||||
{#snippet failed()}
|
||||
<div {@attach attachment}>oops!</div>
|
||||
{/snippet}
|
||||
</svelte:boundary>
|
||||
@ -0,0 +1,22 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
const btn = target.querySelector('button');
|
||||
|
||||
btn?.click();
|
||||
flushSync();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>Toggle</button>
|
||||
<div>Should not transition out</div>
|
||||
`
|
||||
);
|
||||
|
||||
btn?.click();
|
||||
flushSync();
|
||||
assert.htmlEqual(target.innerHTML, '<button>Toggle</button>');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
<script>
|
||||
import { slide } from 'svelte/transition';
|
||||
let showText = $state(false);
|
||||
let show = $state(true);
|
||||
</script>
|
||||
|
||||
<button onclick={() => showText = !showText}>
|
||||
Toggle
|
||||
</button>
|
||||
|
||||
{#if showText}
|
||||
{#if show}
|
||||
<div transition:slide>
|
||||
Should not transition out
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
Loading…
Reference in new issue