mirror of https://github.com/sveltejs/svelte
commit
1d016a16c2
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: account for proxified instance when updating `bind:this`
|
||||||
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'svelte': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: do not dispatch introstart event with animation of animate directive
|
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure scheduled batch is flushed if not obsolete
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: allow `@debug` tags to reference awaited variables
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: re-run fallback props if dependencies update
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ignore comments when reading CSS values
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
p.svelte-xyz {
|
||||||
|
padding: 0 /* it's a comment */ 1em;
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<p>red</p>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
padding: 0 /* it's a comment */ 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
import { tick } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
mode: ['client', 'async-server'],
|
||||||
|
|
||||||
|
async test({ assert, logs }) {
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
assert.deepEqual(logs, [{ data: 'works' }]);
|
||||||
|
},
|
||||||
|
test_ssr({ assert, logs }) {
|
||||||
|
assert.deepEqual(logs, [{ data: 'works' }]);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
<svelte:boundary>
|
||||||
|
{@const data = await Promise.resolve("works")}
|
||||||
|
{@debug data}
|
||||||
|
</svelte:boundary>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
import { tick } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
// Ensure that microtask timing doesn't influence whether or not a scheduled batch is flushed.
|
||||||
|
// Timing can be such that the current_batch is reset before the scheduled flush runs, which
|
||||||
|
// would cause the flush to skip without the fix.
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const [btn] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
btn.click();
|
||||||
|
await tick();
|
||||||
|
assert.htmlEqual(target.innerHTML, '1 1');
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<script>
|
||||||
|
let a = $state(0);
|
||||||
|
let b = $state(0);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if a}
|
||||||
|
{@const toShow = await a}
|
||||||
|
{toShow}
|
||||||
|
{b}
|
||||||
|
{:else}
|
||||||
|
<button
|
||||||
|
onclick={async () => {
|
||||||
|
a = 1;
|
||||||
|
await 1;
|
||||||
|
await 1; // two microtasks needed to get timing right to reproduce the bug
|
||||||
|
b = 1;
|
||||||
|
}}>click</button>
|
||||||
|
{/if}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
const props = $props();
|
||||||
|
// svelte-ignore state_referenced_locally
|
||||||
|
export const name = props.name;
|
||||||
|
</script>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target, logs }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(logs, [
|
||||||
|
{},
|
||||||
|
{ 0: { name: 'Row 0' } },
|
||||||
|
{ 0: { name: 'Row 0' }, 1: { name: 'Row 1' } }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import Row from "./Component.svelte";
|
||||||
|
|
||||||
|
const nums = $state([]);
|
||||||
|
const rows = $derived(nums.map(n => ({id: n, name: `Row ${n}` })));
|
||||||
|
const refs = $state({});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
console.log({...refs});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => nums.push(nums.length)}>Add</button>
|
||||||
|
{#each rows as row (row.id)}
|
||||||
|
<Row name={row.name} bind:this={refs[row.id]} />
|
||||||
|
{/each}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
import { flushSync, tick } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
accessors: false,
|
||||||
|
test({ assert, target }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
|
btn?.click();
|
||||||
|
flushSync();
|
||||||
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`
|
||||||
|
<p>greeting: Hola</p>
|
||||||
|
<button>Change Language</button>
|
||||||
|
`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
import Sub from './sub.svelte';
|
||||||
|
import { set_translation } from './translations.svelte.js';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Sub />
|
||||||
|
|
||||||
|
<button onclick={() => set_translation('Hola')}>
|
||||||
|
Change Language
|
||||||
|
</button>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
import { get_translation } from './translations.svelte.js';
|
||||||
|
|
||||||
|
const {
|
||||||
|
p0 = get_translation()
|
||||||
|
} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>greeting: {p0}</p>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
let greeting = $state('Hello');
|
||||||
|
|
||||||
|
export function get_translation() {
|
||||||
|
return greeting;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function set_translation(value) {
|
||||||
|
greeting = value;
|
||||||
|
}
|
||||||
Loading…
Reference in new issue