diff --git a/src/generators/dom/visitors/IfBlock.ts b/src/generators/dom/visitors/IfBlock.ts index 7e294bc89f..e36c5d9984 100644 --- a/src/generators/dom/visitors/IfBlock.ts +++ b/src/generators/dom/visitors/IfBlock.ts @@ -271,11 +271,12 @@ function compound( `); } + block.builders.unmount.addLine( + `${if_name}${name}.unmount();` + ); + block.builders.destroy.addLine( - `${if_name}{ - ${name}.unmount(); - ${name}.destroy(); - }` + `${if_name}${name}.destroy();` ); } diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index bf5690896d..3177df9b02 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -164,14 +164,12 @@ function create_main_fragment ( state, component ) { }, unmount: function () { + if_block.unmount(); detachNode( if_block_anchor ); }, destroy: function () { - { - if_block.unmount(); - if_block.destroy(); - } + if_block.destroy(); } }; } diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index a4a22ba105..ac25a686c6 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -29,14 +29,12 @@ function create_main_fragment ( state, component ) { }, unmount: function () { + if_block.unmount(); detachNode( if_block_anchor ); }, destroy: function () { - { - if_block.unmount(); - if_block.destroy(); - } + if_block.destroy(); } }; } @@ -116,4 +114,4 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this._torndown = true; }; -export default SvelteComponent; \ No newline at end of file +export default SvelteComponent; diff --git a/test/runtime/samples/component-nested-deeper/Level1.html b/test/runtime/samples/component-nested-deeper/Level1.html new file mode 100644 index 0000000000..0789b14445 --- /dev/null +++ b/test/runtime/samples/component-nested-deeper/Level1.html @@ -0,0 +1,22 @@ +
+ {{#each values as value}} +

level 1 #{{value}}

+ + + And more stuff goes in here + + + {{/each}} +
+ + \ No newline at end of file diff --git a/test/runtime/samples/component-nested-deeper/Level2.html b/test/runtime/samples/component-nested-deeper/Level2.html new file mode 100644 index 0000000000..6742c7d7f9 --- /dev/null +++ b/test/runtime/samples/component-nested-deeper/Level2.html @@ -0,0 +1,8 @@ +
+

level 2

+ {{#if condition}} + TRUE! {{yield}} + {{else}} + FALSE! {{yield}} + {{/if}} +
\ No newline at end of file diff --git a/test/runtime/samples/component-nested-deeper/Level3.html b/test/runtime/samples/component-nested-deeper/Level3.html new file mode 100644 index 0000000000..e09fc525a8 --- /dev/null +++ b/test/runtime/samples/component-nested-deeper/Level3.html @@ -0,0 +1,4 @@ +
+

level 3

+ {{yield}} +
\ No newline at end of file diff --git a/test/runtime/samples/component-nested-deeper/_config.js b/test/runtime/samples/component-nested-deeper/_config.js new file mode 100644 index 0000000000..8c525fedd4 --- /dev/null +++ b/test/runtime/samples/component-nested-deeper/_config.js @@ -0,0 +1,9 @@ +export default { + data: { + values: [1, 2, 3, 4] + }, + + test(assert, component) { + component.set({ values: [2, 3] }); + } +}; diff --git a/test/runtime/samples/component-nested-deeper/main.html b/test/runtime/samples/component-nested-deeper/main.html new file mode 100644 index 0000000000..5ad2d9d319 --- /dev/null +++ b/test/runtime/samples/component-nested-deeper/main.html @@ -0,0 +1,11 @@ + + + \ No newline at end of file