-
-
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.
[BUGFIX beta] Ensure helpers have a consistent API.
Having class based helpers return a different API from "simple" helpers is quite confusing. It makes testing a helper significantly different based on the type of helper, and also makes refactoring from simple to class-based a hazzard. This change ensures that both types of helper return the same basic interface, and enables us to use output similar to the following regardless of the specific type of helper that was exported: ```js module('foo | Helper', function(hooks) { module('unit tests', function(hooks) { setupRenderingTest(hooks); test('returns some-value', async function(assert) { await render(hbs`{{foo 'input' 'values'}}`); assert.equal(this.element.textContent, 'some-value', 'helper works!'); }); }); module('unit tests', function(hooks) { setupTest(hooks); test('returns some-value', function(assert) { let helper = this.owner.factoryFor('helper:foo').create(); assert.equal(helper.compute(['input', 'values']), 'some-value', 'helper works!'); }); }); }); ```
- Loading branch information
Showing
5 changed files
with
72 additions
and
13 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
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
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
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
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