Skip to content

Commit

Permalink
Add failing test for helper teardown in nested helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed May 31, 2015
1 parent 6b82fc8 commit 67685ad
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/ember-htmlbars/tests/helpers/custom_helper_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,36 @@ QUnit.test('dashed helper used in subexpression can recompute', function() {
equal(component.$().text(),
'Who believes his force hath overcome but half his foe');
});

QUnit.test('dashed helper used in subexpression is destroyed', function() {
var didCallDestroy = false;
var DynamicSegment = Helper.extend({
phrase: 'overcomes by',
compute() {
return this.phrase;
},
destroy() {
didCallDestroy = true;
this._super(...arguments);
}
});
var JoinWords = Helper.build(function(params) {
return params.join(' ');
});
registry.register('helper:dynamic-segment', DynamicSegment);
registry.register('helper:join-words', JoinWords);
component = Component.extend({
container,
layout: compile(
`{{join-words "Who"
(dynamic-segment)
"force"
(join-words (join-words "hath overcome but" "half"))
(join-words "his" (join-words "foe"))}}`)
}).create();

runAppend(component);
runDestroy(component);

ok(didCallDestroy, 'destroy was called');
});

0 comments on commit 67685ad

Please sign in to comment.