From 9549d73da65d1bcf79d27780b88dc73c0c2d9df2 Mon Sep 17 00:00:00 2001 From: Felix Fichte Date: Sat, 16 Jul 2022 12:39:15 +0200 Subject: [PATCH 1/2] Fix animationSettled hanging forever --- addon/src/-private/scheduler.ts | 1 + test-app/tests/unit/scheduler-test.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addon/src/-private/scheduler.ts b/addon/src/-private/scheduler.ts index cb224507..4f1d73a7 100644 --- a/addon/src/-private/scheduler.ts +++ b/addon/src/-private/scheduler.ts @@ -238,6 +238,7 @@ class MicroRoutine { } stop() { this.stopped = true; + this.resolve({ stopped: true }); if (this.state && isPromise(this.state.value)) { fireCancellation(this.state.value); } diff --git a/test-app/tests/unit/scheduler-test.js b/test-app/tests/unit/scheduler-test.js index b1dc6448..f7e5c6d9 100644 --- a/test-app/tests/unit/scheduler-test.js +++ b/test-app/tests/unit/scheduler-test.js @@ -284,8 +284,11 @@ module('Unit | scheduler', function (hooks) { }); stop(task); resolve(); - yield task; - assert.ok(false, 'should never get here'); + let yielded = yield task; + assert.ok( + yielded.stopped, + 'After stopping a Microtask it should yield `{ stopped: true }`.', + ); }); yield microwait(); assert.ok(true, 'got to end'); From 91139ec68d4ca8307a8d02d186c0de6e4655548a Mon Sep 17 00:00:00 2001 From: Felix Fichte Date: Sat, 16 Jul 2022 12:55:42 +0200 Subject: [PATCH 2/2] Fix assert amount in test --- test-app/tests/unit/scheduler-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-app/tests/unit/scheduler-test.js b/test-app/tests/unit/scheduler-test.js index f7e5c6d9..87987e45 100644 --- a/test-app/tests/unit/scheduler-test.js +++ b/test-app/tests/unit/scheduler-test.js @@ -274,7 +274,7 @@ module('Unit | scheduler', function (hooks) { }); test('promise returned from spawn does not resolve if an inner promise resolves after stop', function (assert) { - assert.expect(1); + assert.expect(2); return spawn(function* () { spawn(function* () {