feat: add an tickOptions parameter with property processNewMacroTasksSynchronously. (#33838)
This option will control whether to invoke the new macro tasks when ticking. Close #33799 PR Close #33838
This commit is contained in:

committed by
Miško Hevery

parent
2562a3b1b0
commit
17b862cf82
@ -145,6 +145,22 @@ describe('FakeAsyncTestZoneSpec', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not queue new macro task on tick with processNewMacroTasksSynchronously=false',
|
||||
() => {
|
||||
function nestedTimer(callback: () => any): void {
|
||||
setTimeout(() => setTimeout(() => callback()));
|
||||
}
|
||||
fakeAsyncTestZone.run(() => {
|
||||
const callback = jasmine.createSpy('callback');
|
||||
nestedTimer(callback);
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
testZoneSpec.tick(0, null, {processNewMacroTasksSynchronously: false});
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
testZoneSpec.flush();
|
||||
expect(callback).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it('should run queued timer after sufficient clock ticks', () => {
|
||||
fakeAsyncTestZone.run(() => {
|
||||
let ran = false;
|
||||
|
Reference in New Issue
Block a user