-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14987 from emberjs/mem-leak
[BUGFIX release] don’t leak last destroyedComponents
- Loading branch information
Showing
2 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/ember-glimmer/tests/integration/components/destroy-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { set } from 'ember-metal'; | ||
import { Component } from '../../utils/helpers'; | ||
import { moduleFor, RenderingTest } from '../../utils/test-case'; | ||
|
||
moduleFor('Component destroy', class extends RenderingTest { | ||
['@test it correctly releases the destroyed components'](assert) { | ||
let FooBarComponent = Component.extend({}); | ||
|
||
this.registerComponent('foo-bar', { ComponentClass: FooBarComponent, template: 'hello' }); | ||
|
||
this.render('{{#if switch}}{{#foo-bar}}{{foo-bar}}{{/foo-bar}}{{/if}}', { switch: true }); | ||
|
||
this.assertComponentElement(this.firstChild, { content: 'hello' }); | ||
|
||
this.runTask(() => set(this.context, 'switch', false)); | ||
|
||
this.assertText(''); | ||
|
||
assert.equal(this.env.destroyedComponents.length, 0, 'enviroment.destroyedComponents should be empty'); | ||
} | ||
}); |