diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 0b8167e752..341608d428 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -192,7 +192,7 @@ export default function dom ( parsed: Parsed, source: string, options: CompileOp ${templateProperties.ondestroy && `${generator.alias( 'template' )}.ondestroy.call( this );`} if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/index.js b/test/js/index.js index 34b0c5bb69..92bb969d59 100644 --- a/test/js/index.js +++ b/test/js/index.js @@ -34,11 +34,6 @@ describe( 'js', () => { const expected = fs.readFileSync( `${dir}/expected.js`, 'utf-8' ); const expectedBundle = fs.readFileSync( `${dir}/expected-bundle.js`, 'utf-8' ); - assert.equal( - actual.trim().replace( /^\s+$/gm, '' ), - expected.trim().replace( /^\s+$/gm, '' ) - ); - return rollup({ entry: `${dir}/_actual.js`, plugins: [{ @@ -52,6 +47,11 @@ describe( 'js', () => { const actualBundle = bundle.generate({ format: 'es' }).code; fs.writeFileSync( `${dir}/_actual-bundle.js`, actualBundle ); + assert.equal( + actual.trim().replace( /^\s+$/gm, '' ), + expected.trim().replace( /^\s+$/gm, '' ) + ); + assert.equal( actualBundle.trim().replace( /^\s+$/gm, '' ), expectedBundle.trim().replace( /^\s+$/gm, '' ) diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index 8d4fe1fa29..dff2d1683a 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -205,7 +205,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 8e9ad3ba19..3d832bfd50 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -77,7 +77,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 823a40e235..3e54308477 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -167,7 +167,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index d627a99912..f0475aeecf 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -63,7 +63,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index ef61a29a1d..aa890e034d 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -298,7 +298,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index af2a1ca484..ebae8ddcd3 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -161,7 +161,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 776d0b7367..8dbbc37e8f 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -195,7 +195,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js index a193b30993..c57bcd2870 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -73,7 +73,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; 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 6119a9ca37..0ce8c03f6b 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -237,7 +237,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index 1b6f454908..a4a22ba105 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -109,7 +109,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index e2e344ed84..8f48b64b17 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -214,7 +214,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index dd0d151c95..8f87d57802 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -86,7 +86,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 7d82f3f2be..4b6f096e1d 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -193,7 +193,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index acc10d855b..52a943887b 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -79,7 +79,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js index ce0adb916d..04b05b1fb1 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js @@ -164,7 +164,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio template.ondestroy.call( this ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js index 180b484c6a..f0b4cbd24b 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected.js @@ -60,7 +60,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio template.ondestroy.call( this ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index a723f7465b..502e3e5d19 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -373,7 +373,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {}; diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index 07f46a3eb1..2c1d8b18c5 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -245,7 +245,7 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio this.fire( 'destroy' ); if ( detach !== false ) this._fragment.unmount(); - this._fragment.destroy( false ); // TODO no arguments to destroy + this._fragment.destroy(); this._fragment = null; this._state = {};