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

Commit

Permalink
fix: #604, sometimes setInterval test spec will fail on Android 4.4 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion authored and mhevery committed Jan 17, 2017
1 parent 95ad315 commit e3cd1f4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/common/setInterval.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,25 @@ describe('setInterval', function() {
const testZone = Zone.current.fork(Zone['wtfZoneSpec']).fork({name: 'TestZone'});
testZone.run(() => {
let id;
let intervalCount = 0;
const intervalFn = function() {
intervalCount++;
expect(Zone.current.name).toEqual(('TestZone'));
global[zoneSymbol('setTimeout')](function() {
const intervalUnitLog = [
'> Zone:invokeTask:setInterval("<root>::ProxyZone::WTF::TestZone")',
'< Zone:invokeTask:setInterval'
];
let intervalLog = [];
for (let i = 0; i < intervalCount; i++) {
intervalLog = intervalLog.concat(intervalUnitLog);
}
expect(wtfMock.log).toEqual([
'# Zone:fork("<root>::ProxyZone::WTF", "TestZone")',
'> Zone:invoke:unit-test("<root>::ProxyZone::WTF::TestZone")',
'# Zone:schedule:macroTask:setInterval("<root>::ProxyZone::WTF::TestZone", ' + id + ')',
'< Zone:invoke:unit-test',
'> Zone:invokeTask:setInterval("<root>::ProxyZone::WTF::TestZone")',
'< Zone:invokeTask:setInterval'
]);
'< Zone:invoke:unit-test'
].concat(intervalLog));
clearInterval(cancelId);
done();
});
Expand Down

0 comments on commit e3cd1f4

Please sign in to comment.