Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test-app/tests/integration/helpers/queue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ module('Integration | Helper | {{queue}}', function(hooks) {
assert.dom('p').hasText('4', 'should render 4');
});

test('it can curry a function with the fn helper', async function(assert) {
this.doAThing = () => null;
this.process = (x) => this.set('value', x * x);
this.undoAThing = () => null;
this.set('value', 0);
await render(hbs`
<p>{{this.value}}</p>
<button type="button" {{on "click" (queue this.doAThing (fn this.process 3) this.undoAThing)}}>
Calculate
</button>
`);

assert.dom('p').hasText('0', 'precond - should render 0');
await click('button');
assert.dom('p').hasText('9', 'should render 9');
});

test('it handles promises', async function(assert) {
this.set('value', 3);
this.actions.doAThingThatTakesTime = resolve;
Expand Down
Loading