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

fix(fakeAsyncTest): fix #937, let user be able to customize testable macroTask #938

Merged
merged 3 commits into from Dec 27, 2017

Conversation

JiaLiPassion
Copy link
Collaborator

@JiaLiPassion JiaLiPassion commented Oct 25, 2017

fix #937
let user be able to customize which macroTasks can be test with fakeAsyncTestSpec.
for example, in #937, user want to test cavans.toBlob(). with this PR, user can achieve it in two ways.

  1. pass the options from FakeAsyncTestSpec constructor
const testZoneSpec = new FakeAsyncTestZoneSpec('name', false, [{source: 'HTMLCanvasElement.toBlob'}]);
  1. sometimes application test code can't access FakeAsyncTestSpec initialize process, so user can also define a global variable before load fakeAsyncTest.
  • browser
 window['__zone_symbol__FakeAsyncTestMacroTask'] = [{
     source: 'HTMLCanvasElement.toBlob',
     callbackArgs: ['testBlobData']  // the test blob data which will be passed back to callback
}];
  • Node
 global['__zone_symbol__FakeAsyncTestMacroTask'] = [{
     source: 'HTMLCanvasElement.toBlob',
     callbackArgs: ['testBlobData']  // the test blob data which will be passed back to callback
}];

@vikerman , please review.

And the CI will pass after #935 is merged (because rxjs 5.5.0's issue).

@mhevery mhevery merged commit a4e10f5 into angular:master Dec 27, 2017
mhevery pushed a commit to sandersn/zone.js that referenced this pull request Dec 27, 2017
…stable macroTask (angular#938)

* fix(fakeAsyncTest): fix angular#937, let user be able to customize testable macroTask

* add global flag to define fakeAsyncTest macroTaskOptions

* support set callback arguments
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.

Unknown macroTask scheduled in fake async test: HTMLCanvasElement.toBlob
3 participants