From f6d0fbe0afd5b861524b217d74ecaf9d62c331ef Mon Sep 17 00:00:00 2001 From: Bryan Terce Date: Wed, 19 Jun 2019 15:31:06 -0700 Subject: [PATCH] Add tests for unmounting entries in an each block --- .../each-block-keyed-shift/Nested.svelte | 5 ++++ .../samples/each-block-keyed-shift/_config.js | 27 +++++++++++++++++++ .../each-block-keyed-shift/main.svelte | 9 +++++++ 3 files changed, 41 insertions(+) create mode 100644 test/runtime/samples/each-block-keyed-shift/Nested.svelte create mode 100644 test/runtime/samples/each-block-keyed-shift/_config.js create mode 100644 test/runtime/samples/each-block-keyed-shift/main.svelte diff --git a/test/runtime/samples/each-block-keyed-shift/Nested.svelte b/test/runtime/samples/each-block-keyed-shift/Nested.svelte new file mode 100644 index 0000000000..82df711742 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-shift/Nested.svelte @@ -0,0 +1,5 @@ + + +

{title}

\ No newline at end of file diff --git a/test/runtime/samples/each-block-keyed-shift/_config.js b/test/runtime/samples/each-block-keyed-shift/_config.js new file mode 100644 index 0000000000..44ca8447f0 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-shift/_config.js @@ -0,0 +1,27 @@ +export default { + props: { + titles: [{ name: 'a', }, { name: 'b' }, { name: 'c' }] + }, + + html: ` +

a

+

b

+

c

+ `, + + test({ assert, component, target }) { + component.titles = [{ name: 'b' }, { name: 'c' }]; + + assert.htmlEqual(target.innerHTML, ` +

b

+

c

+ `); + + component.titles = [{ name: 'c' }]; + + assert.htmlEqual(target.innerHTML, ` +

c

+ `); + + } +}; diff --git a/test/runtime/samples/each-block-keyed-shift/main.svelte b/test/runtime/samples/each-block-keyed-shift/main.svelte new file mode 100644 index 0000000000..b8954e17fd --- /dev/null +++ b/test/runtime/samples/each-block-keyed-shift/main.svelte @@ -0,0 +1,9 @@ + + +{#each titles as title (title.name)} + +{/each} \ No newline at end of file