Skip to content

Commit

Permalink
Bug in timeout helper (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Nov 1, 2021
1 parent 4640e01 commit 6c65fd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions addon/utils/timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import { later } from '@ember/runloop';
export function timeout(destroyable, t) {
if (typeof destroyable !== 'number') {
return new StatefulPromise().create(destroyable, (resolve) => {
setTimeout(() => {
resolve();
}, t);
});
} else {
return new StatefulPromise((resolve) => {
later(
destroyable,
() => {
Expand All @@ -18,5 +12,11 @@ export function timeout(destroyable, t) {
t
);
});
} else {
return new StatefulPromise((resolve) => {
later(() => {
resolve();
}, t);
});
}
}
6 changes: 3 additions & 3 deletions tests/integration/components/playground-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ module('Integration | Component | playground', function (hooks) {
.dom('[data-test-playground-perform-count]')
.hasText('Perform Count: 0');

// await isn't right. I would expect this to await until the StatefulPromise has finished
// perhaps need to register with test infra
await click('[data-test-playground-button]');
click('[data-test-playground-button]');

await waitFor('[data-test-playground-button]:is([disabled])');

assert.dom('[data-test-playground-button]').hasAttribute('disabled');
assert
Expand Down

0 comments on commit 6c65fd8

Please sign in to comment.