-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make compute own helper then drop ember-composable-helpers as dependency
- Loading branch information
1 parent
3118f85
commit 9705912
Showing
5 changed files
with
66 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// https://github.com/DockYard/ember-composable-helpers/blob/master/addon/helpers/compute.js | ||
|
||
import { helper } from '@ember/component/helper'; | ||
|
||
export function compute([action, ...params]) { | ||
console('own helper'); | ||
return action(...params); | ||
} | ||
|
||
export default helper(compute); |
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 @@ | ||
export { default, compute } from 'ember-light-table/helpers/compute'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// https://github.com/DockYard/ember-composable-helpers/blob/master/tests/integration/helpers/compute-test.js | ||
|
||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
module('Integration | Helper | {{compute}}', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
hooks.beforeEach(function() { | ||
this.actions = {}; | ||
this.send = (actionName, ...args) => this.actions[actionName].apply(this, args); | ||
}); | ||
|
||
test("It calls an action and returns it's value", async function(assert) { | ||
this.actions.square = (x) => x * x; | ||
await render(hbs`{{compute (action "square") 4}}`); | ||
|
||
assert.equal(this.element.textContent.trim(), '16', '4 squared is 16'); | ||
}); | ||
}); |
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