Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix(spec): do not count requestAnimationFrame as a pending timer #854

Merged
merged 1 commit into from
Jul 25, 2017

Conversation

vikerman
Copy link
Contributor

We added a new fature to FakeAsyncTestSpec to treat a
requestAnimationFrame as a timer with 16ms. However this breaks existing
Angular project tests because the RAF is reported as a pending timer at
the end of the test.

This change makes sure that existing Angular tests are not broken by not
counting RAF-s as pending timers at the end of a test.

@@ -35,7 +36,7 @@

scheduleFunction(
cb: Function, delay: number, args: any[] = [], isPeriodic: boolean = false,
id: number = -1): number {
isRequestAnimationFrame: boolean = false, id: number = -1): number {
Copy link
Collaborator

@JiaLiPassion JiaLiPassion Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikerman , should we also add an option flag in FakeAsyncTestSpec to control whether to consider RAF as timer or not?

constructor(namePrefix: string, isRequestAnimationFrame: boolean = false) {
      this.name = 'fakeAsyncTestZone for ' + namePrefix;
      this.isRequestAnimationFrame = isRequestAnimationFrame;
    }

Copy link
Contributor Author

@vikerman vikerman Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added it as an optional parameter to FakeAsyncTestSpec. Will enforce it in Angular 5.0 as a breaking change but leave it as it is for now.

We added a new fature to FakeAsyncTestSpec to treat a
requestAnimationFrame as a timer with 16ms. However this breaks existing
Angular project tests because the RAF is reported as a pending timer at
the end of the test.

This change makes sure that existing Angular tests are not broken by not
counting RAF-s as pending timers at the end of a test.
@mhevery mhevery merged commit eca04b0 into angular:master Jul 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants