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

Commit

Permalink
chore: release v0.8.22
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Mar 31, 2018
1 parent 66c6f97 commit ac4ceb3
Show file tree
Hide file tree
Showing 27 changed files with 1,488 additions and 640 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<a name="0.8.22"></a>
## [0.8.22](https://github.com/angular/zone.js/compare/v0.8.21...0.8.22) (2018-03-31)


### Bug Fixes

* **fakeAsync:** fix [#1050](https://github.com/angular/zone.js/issues/1050), should only reset patched Date.now until fakeAsync exit ([#1051](https://github.com/angular/zone.js/issues/1051)) ([e15d735](https://github.com/angular/zone.js/commit/e15d735))
* **fakeAsyncTest:** fix [#1061](https://github.com/angular/zone.js/issues/1061), fakeAsync should support setImmediate ([#1062](https://github.com/angular/zone.js/issues/1062)) ([66c6f97](https://github.com/angular/zone.js/commit/66c6f97))



<a name="0.8.21"></a>
## [0.8.21](https://github.com/angular/zone.js/compare/v0.8.20...0.8.21) (2018-03-30)

Expand Down
10 changes: 3 additions & 7 deletions dist/async-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ var AsyncTestZoneSpec = /** @class */ (function () {
this.runZone = Zone.current;
this.unresolvedChainedPromiseCount = 0;
this.name = 'asyncTestZone for ' + namePrefix;
this.properties = {
'AsyncTestZoneSpec': this
};
this.properties = { 'AsyncTestZoneSpec': this };
}
AsyncTestZoneSpec.prototype._finishCallbackIfDone = function () {
var _this = this;
if (!(this._pendingMicroTasks || this._pendingMacroTasks || this.unresolvedChainedPromiseCount !== 0)) {
if (!(this._pendingMicroTasks || this._pendingMacroTasks)) {
// We do this because we would like to catch unhandled rejected promises.
this.runZone.run(function () {
setTimeout(function () {
Expand Down Expand Up @@ -63,7 +61,7 @@ var AsyncTestZoneSpec = /** @class */ (function () {
this._isSync = false;
}
if (task.type === 'microTask' && task.data && task.data instanceof Promise) {
// check whether the promise is a chained promise
// check whether the promise is a chained promise
if (task.data[AsyncTestZoneSpec.symbolParentUnresolved] === true) {
// chained promise is being scheduled
this.unresolvedChainedPromiseCount--;
Expand All @@ -90,12 +88,10 @@ var AsyncTestZoneSpec = /** @class */ (function () {
// was scheduled/invoked/canceled.
AsyncTestZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
try {
this.patchPromiseForTest();
this._isSync = true;
return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
}
finally {
this.unPatchPromiseForTest();
var afterTaskCounts = parentZoneDelegate._taskCounts;
if (this._isSync) {
this._finishCallbackIfDone();
Expand Down
17 changes: 16 additions & 1 deletion dist/fake-async-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
this._uncaughtPromiseErrors = Promise[Zone.__symbol__('uncaughtPromiseErrors')];
this.pendingPeriodicTimers = [];
this.pendingTimers = [];
this.patchDateLocked = false;
this.properties = { 'FakeAsyncTestZoneSpec': this };
this.name = 'fakeAsyncTestZone for ' + namePrefix;
// in case user can't access the construction of FakeAsyncTestSpec
Expand Down Expand Up @@ -307,12 +308,21 @@
return;
}
global['Date'] = FakeDate;
FakeDate.prototype = OriginalDate.prototype;
};
FakeAsyncTestZoneSpec.resetDate = function () {
if (global['Date'] === FakeDate) {
global['Date'] = OriginalDate;
}
};
FakeAsyncTestZoneSpec.prototype.lockDatePatch = function () {
this.patchDateLocked = true;
FakeAsyncTestZoneSpec.patchDate();
};
FakeAsyncTestZoneSpec.prototype.unlockDatePatch = function () {
this.patchDateLocked = false;
FakeAsyncTestZoneSpec.resetDate();
};
FakeAsyncTestZoneSpec.prototype.tick = function (millis, doTick) {
if (millis === void 0) { millis = 0; }
FakeAsyncTestZoneSpec.assertInZone();
Expand Down Expand Up @@ -371,6 +381,9 @@
case 'setTimeout':
task.data['handleId'] = this._setTimeout(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
break;
case 'setImmediate':
task.data['handleId'] = this._setTimeout(task.invoke, 0, Array.prototype.slice.call(task.data['args'], 1));
break;
case 'setInterval':
task.data['handleId'] = this._setInterval(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
break;
Expand Down Expand Up @@ -439,7 +452,9 @@
return delegate.invoke(target, callback, applyThis, applyArgs, source);
}
finally {
FakeAsyncTestZoneSpec.resetDate();
if (!this.patchDateLocked) {
FakeAsyncTestZoneSpec.resetDate();
}
}
};
FakeAsyncTestZoneSpec.prototype.findMacroTaskOption = function (task) {
Expand Down
15 changes: 10 additions & 5 deletions dist/jasmine-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
return syncZone.run(describeBody, this, arguments);
};
}
function runInTestZone(testBody, queueRunner, done) {
function runInTestZone(testBody, applyThis, queueRunner, done) {
var isClockInstalled = !!jasmine[symbol('clockInstalled')];
var testProxyZoneSpec = queueRunner.testProxyZoneSpec;
var testProxyZone = queueRunner.testProxyZone;
Expand All @@ -127,18 +127,23 @@
var _fakeAsyncTestZoneSpec = new FakeAsyncTestZoneSpec();
lastDelegate = testProxyZoneSpec.getDelegate();
testProxyZoneSpec.setDelegate(_fakeAsyncTestZoneSpec);
_fakeAsyncTestZoneSpec.lockDatePatch();
}
}
try {
if (done) {
return testProxyZone.run(testBody, this, [done]);
return testProxyZone.run(testBody, applyThis, [done]);
}
else {
return testProxyZone.run(testBody, this);
return testProxyZone.run(testBody, applyThis);
}
}
finally {
if (isClockInstalled) {
var _fakeAsyncTestZoneSpec = testProxyZoneSpec.getDelegate();
if (_fakeAsyncTestZoneSpec) {
_fakeAsyncTestZoneSpec.unlockDatePatch();
}
testProxyZoneSpec.setDelegate(lastDelegate);
}
}
Expand All @@ -153,9 +158,9 @@
// Note we have to make a function with correct number of arguments, otherwise jasmine will
// think that all functions are sync or async.
return (testBody && (testBody.length ? function (done) {
return runInTestZone(testBody, this.queueRunner, done);
return runInTestZone(testBody, this, this.queueRunner, done);
} : function () {
return runInTestZone(testBody, this.queueRunner);
return runInTestZone(testBody, this, this.queueRunner);
}));
}
var QueueRunner = jasmine.QueueRunner;
Expand Down
2 changes: 1 addition & 1 deletion dist/jasmine-patch.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var ProxyZoneSpec = /** @class */ (function () {
return this._delegateSpec;
};
ProxyZoneSpec.prototype.resetDelegate = function () {
var delegateSpec = this.getDelegate();
this.setDelegate(this.defaultSpecDelegate);
};
ProxyZoneSpec.prototype.tryTriggerHasTask = function (parentZoneDelegate, currentZone, targetZone) {
Expand Down
Loading

0 comments on commit ac4ceb3

Please sign in to comment.