fix(zone.js): tickOptions's processNewMacroTasksSynchronously should default to true when flag omitted (#35814)

Calling `tick(0, null)` defaults `processNewMacroTasksSynchronously` flag to `true`, however calling  `tick(0, null, {})` defaults `processNewMacroTasksSynchronously` to `undefined`. This is undesirable behavior since unless the flag is set explicitly it should still default to `true`.

PR Close #35814
This commit is contained in:
JiaLiPassion
2020-03-03 11:00:21 +09:00
committed by Matias Niemelä
parent 958165888c
commit 55b3f97be0
2 changed files with 17 additions and 2 deletions

View File

@ -145,6 +145,20 @@ describe('FakeAsyncTestZoneSpec', () => {
});
}));
it('should default to processNewMacroTasksSynchronously if providing other flags', () => {
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, {});
expect(callback).toHaveBeenCalled();
});
});
it('should not queue new macro task on tick with processNewMacroTasksSynchronously=false',
() => {
function nestedTimer(callback: () => any): void {