Skip to content

Commit

Permalink
Add test for non-interactive custom modifier lifecycle hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX committed May 29, 2019
1 parent 1cb5f67 commit ff760cf
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,38 @@ moduleFor(
}
}
);

moduleFor(
'Rendering test: non-interactive custom modifiers',
class extends RenderingTestCase {
getBootOptions() {
return { isInteractive: false };
}

[`@test doesn't trigger lifecycle hooks when non-interactive`](assert) {
let ModifierClass = setModifierManager(
owner => {
return new CustomModifierManager(owner);
},
EmberObject.extend({
didInsertElement() {
assert.ok(false);
},
didUpdate() {
assert.ok(false);
},
willDestroyElement() {
assert.ok(false);
},
})
);

this.registerModifier('foo-bar', ModifierClass);

this.render('<h1 {{foo-bar baz}}>hello world</h1>');
runTask(() => this.context.set('baz', 'Hello'));

this.assertHTML('<h1>hello world</h1>');
}
}
);

0 comments on commit ff760cf

Please sign in to comment.