Skip to content

Commit

Permalink
Add test for parameterless helper invocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored and krisselden committed May 6, 2016
1 parent 8f38585 commit 714b3d7
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,30 @@ moduleFor('Helpers test: custom helpers', class extends RenderingTest {
this.assertText('Who overcomes by force hath overcome but half his foe');
}

['@test parameterless helper is usable in subexpressions']() {
this.registerHelper('should-show', () => { return true; });

this.render(`{{#if (should-show)}}true{{/if}}`);

this.assertText('true');

this.runTask(() => this.rerender());

this.assertText('true');
}

['@glimmer parameterless helper is usable in attributes']() {
this.registerHelper('foo-bar', () => { return 'baz'; });

this.render(`<div data-foo-bar="{{foo-bar}}"></div>`);

this.assertHTML('<div data-foo-bar="baz"></div>');

this.runTask(() => this.rerender());

this.assertHTML('<div data-foo-bar="baz"></div>');
}

['@test simple helper not usable with a block']() {
this.registerHelper('some-helper', () => {});

Expand Down

0 comments on commit 714b3d7

Please sign in to comment.