mirror of https://github.com/sveltejs/svelte
commit
38f5911a3f
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: adjust keyed each block equality handling
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve indexed each equality
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: prevent snippet children conflict
|
@ -0,0 +1,10 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
error: {
|
||||||
|
code: 'conflicting-children-snippet',
|
||||||
|
message:
|
||||||
|
'Cannot use explicit children snippet at the same time as implicit children content. Remove either the non-whitespace content or the children snippet block',
|
||||||
|
position: [320, 353]
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,25 @@
|
|||||||
|
<!-- ok -->
|
||||||
|
<Button>
|
||||||
|
hello
|
||||||
|
</Button>
|
||||||
|
<Button>
|
||||||
|
{#snippet children()}hi{/snippet}
|
||||||
|
</Button>
|
||||||
|
<Button>
|
||||||
|
hello
|
||||||
|
{#snippet foo()}x{/snippet}
|
||||||
|
</Button>
|
||||||
|
<Button>
|
||||||
|
{#snippet children()}hi{/snippet}
|
||||||
|
{#snippet foo()}x{/snippet}
|
||||||
|
</Button>
|
||||||
|
<div>
|
||||||
|
hello
|
||||||
|
{#snippet children()}hi{/snippet}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- invalid -->
|
||||||
|
<Button>
|
||||||
|
hello
|
||||||
|
{#snippet children()}hi{/snippet}
|
||||||
|
</Button>
|
@ -0,0 +1,21 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `100\n<button>Update</button>`,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
/**
|
||||||
|
* @type {{ click: () => void; }}
|
||||||
|
*/
|
||||||
|
let btn1;
|
||||||
|
|
||||||
|
[btn1] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn1.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `1000\n<button>Update</button>`);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
|
const roomState = writable({
|
||||||
|
users: {"gary": { name: "gary", value: 100 }},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each Object.values($roomState.users) as user (user.name)}
|
||||||
|
{user.value}
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
<button onclick={() => $roomState.users["gary"].value = 1000}>Update</button>
|
@ -0,0 +1,21 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `1\n1\n1\n1\n<button>+</button>`,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
/**
|
||||||
|
* @type {{ click: () => void; }}
|
||||||
|
*/
|
||||||
|
let btn1;
|
||||||
|
|
||||||
|
[btn1] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn1.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `2\n2\n2\n2\n<button>+</button>`);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,26 @@
|
|||||||
|
<script>
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
|
let store = writable([{ value: 1 }]);
|
||||||
|
let storeDeeper = writable({ items: [{ value: 1 }] });
|
||||||
|
|
||||||
|
function increment() {
|
||||||
|
$store[0].value++;
|
||||||
|
$storeDeeper.items[0].value++;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each $store as item (item)}
|
||||||
|
{item.value}
|
||||||
|
{/each}
|
||||||
|
{#each $storeDeeper.items as item (item)}
|
||||||
|
{item.value}
|
||||||
|
{/each}
|
||||||
|
{#each $store as item}
|
||||||
|
{item.value}
|
||||||
|
{/each}
|
||||||
|
{#each $storeDeeper.items as item}
|
||||||
|
{item.value}
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
<button onclick={increment}>+</button>
|
Loading…
Reference in new issue