Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test case for GH#332. #335

Merged
merged 2 commits into from
Mar 9, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/backburner/deferred-action-queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class DeferredActionQueues {

if (queue.hasWork() === false) {
this.queueNameIndex++;
if (fromAutorun) {
if (fromAutorun && this.queueNameIndex < numberOfQueues) {
return QUEUE_STATE.Pause;
}
} else {
Expand Down
28 changes: 28 additions & 0 deletions tests/autorun-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,31 @@ QUnit.test('can be canceled (private API)', function(assert) {

setTimeout(done, 10);
});

QUnit.test('autorun interleaved with microtasks do not get dropped [GH#332]', function(assert) {
let done = assert.async();
let actual: string[] = [];
let bb = new Backburner(['actions', 'render']);

bb.schedule('render', function() {
actual.push('first');

Promise.resolve().then(() => {
actual.push('second');

return Promise.resolve().then(() => {
actual.push('third');

bb.schedule('actions', () => {
actual.push('fourth');
});
});
});
});

setTimeout(function() {
assert.deepEqual(actual, ['first', 'second', 'third', 'fourth']);

done();
});
});