From 5ff1f8253aee6603238796161ef0653681de4d44 Mon Sep 17 00:00:00 2001 From: Igor Emets Date: Tue, 14 May 2019 13:32:30 +0300 Subject: [PATCH] Fixing #2668, add test case "each-block-keyed-containing-self-in-if-with-else-branch" --- .../Nested.svelte | 5 ++ .../_config.js | 48 +++++++++++++++++++ .../main.svelte | 19 ++++++++ 3 files changed, 72 insertions(+) create mode 100644 test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/Nested.svelte create mode 100644 test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/_config.js create mode 100644 test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/main.svelte diff --git a/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/Nested.svelte b/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/Nested.svelte new file mode 100644 index 000000000000..a9831fc1a9c7 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/Nested.svelte @@ -0,0 +1,5 @@ + + +{item.id} diff --git a/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/_config.js b/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/_config.js new file mode 100644 index 000000000000..0aebab391c07 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/_config.js @@ -0,0 +1,48 @@ +export default { + props: { + list: [ + { id: 1 }, + { id: 2 }, + { id: 3, children: [{ id: 30 }, { id: 31 }, { id: 32 }] }, + ], + activeId: null, + }, + + html: ` + + `, + + test({ assert, component, target }) { + component.activeId = 3; + + assert.htmlEqual(target.innerHTML, ` + + `); + + + component.activeId = null; + + assert.htmlEqual(target.innerHTML, ` + + `); + } +}; diff --git a/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/main.svelte b/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/main.svelte new file mode 100644 index 000000000000..5d5c4ba35d12 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-containing-self-in-if-with-else-branch/main.svelte @@ -0,0 +1,19 @@ + + +