diff --git a/addon/utils/timeout.js b/addon/utils/timeout.js index 7043886..2291449 100644 --- a/addon/utils/timeout.js +++ b/addon/utils/timeout.js @@ -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, () => { @@ -18,5 +12,11 @@ export function timeout(destroyable, t) { t ); }); + } else { + return new StatefulPromise((resolve) => { + later(() => { + resolve(); + }, t); + }); } } diff --git a/tests/integration/components/playground-test.js b/tests/integration/components/playground-test.js index dbd1e2b..045d65d 100644 --- a/tests/integration/components/playground-test.js +++ b/tests/integration/components/playground-test.js @@ -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