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

Commit

Permalink
build: release zone.js 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion authored and vikerman committed May 3, 2019
1 parent 10e1b0c commit c555b08
Show file tree
Hide file tree
Showing 17 changed files with 429 additions and 245 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,19 @@
<a name="0.9.1"></a>
## [0.9.1](https://github.com/angular/zone.js/compare/v0.9.0...0.9.1) (2019-04-30)


### Bug Fixes

* ensure that EventTarget is patched prior to legacy property descriptor patch ([#1214](https://github.com/angular/zone.js/issues/1214)) ([aca4728](https://github.com/angular/zone.js/commit/aca4728))
* fakeAsyncTest requestAnimationFrame should pass timestamp as parameter ([#1220](https://github.com/angular/zone.js/issues/1220)) ([62b8525](https://github.com/angular/zone.js/commit/62b8525)), closes [#1216](https://github.com/angular/zone.js/issues/1216)


### Features

* add option to disable jasmine clock patch, also rename the flag of auto jump in FakeAsyncTest ([#1222](https://github.com/angular/zone.js/issues/1222)) ([10e1b0c](https://github.com/angular/zone.js/commit/10e1b0c))



<a name="0.9.0"></a>
# [0.9.0](https://github.com/angular/zone.js/compare/v0.8.29...0.9.0) (2019-03-12)

Expand Down
2 changes: 1 addition & 1 deletion dist/fake-async-test.js
Expand Up @@ -145,7 +145,7 @@ var __spread = (undefined && undefined.__spread) || function () {
if (doTick) {
doTick(this._currentTime - lastCurrentTime);
}
var retval = current_1.func.apply(global, current_1.args);
var retval = current_1.func.apply(global, current_1.isRequestAnimationFrame ? [this._currentTime] : current_1.args);
if (!retval) {
// Uncaught exception in the current scheduled function. Stop processing the queue.
break;
Expand Down
92 changes: 50 additions & 42 deletions dist/jasmine-patch.js
Expand Up @@ -51,7 +51,13 @@
var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe'));
var symbol = Zone.__symbol__;
// whether patch jasmine clock when in fakeAsync
var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true;
var disablePatchingJasmineClock = _global[symbol('fakeAsyncDisablePatchingClock')] === true;
// the original variable name fakeAsyncPatchLock is not accurate, so the name will be
// fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we also
// automatically disable the auto jump into fakeAsync feature
var enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock &&
((_global[symbol('fakeAsyncPatchLock')] === true) ||
(_global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true));
var ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true;
if (!ignoreUnhandledRejection) {
var globalErrors_1 = jasmine.GlobalErrors;
Expand Down Expand Up @@ -100,48 +106,50 @@
return originalJasmineFn.apply(this, arguments);
};
});
// need to patch jasmine.clock().mockDate and jasmine.clock().tick() so
// they can work properly in FakeAsyncTest
var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']);
jasmine['clock'] = function () {
var clock = originalClockFn.apply(this, arguments);
if (!clock[symbol('patched')]) {
clock[symbol('patched')] = symbol('patched');
var originalTick_1 = (clock[symbol('tick')] = clock.tick);
clock.tick = function () {
var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
if (fakeAsyncZoneSpec) {
return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments);
}
return originalTick_1.apply(this, arguments);
};
var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate);
clock.mockDate = function () {
var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
if (fakeAsyncZoneSpec) {
var dateTime = arguments.length > 0 ? arguments[0] : new Date();
return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] :
arguments);
if (!disablePatchingJasmineClock) {
// need to patch jasmine.clock().mockDate and jasmine.clock().tick() so
// they can work properly in FakeAsyncTest
var originalClockFn_1 = (jasmine[symbol('clock')] = jasmine['clock']);
jasmine['clock'] = function () {
var clock = originalClockFn_1.apply(this, arguments);
if (!clock[symbol('patched')]) {
clock[symbol('patched')] = symbol('patched');
var originalTick_1 = (clock[symbol('tick')] = clock.tick);
clock.tick = function () {
var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
if (fakeAsyncZoneSpec) {
return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments);
}
return originalTick_1.apply(this, arguments);
};
var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate);
clock.mockDate = function () {
var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
if (fakeAsyncZoneSpec) {
var dateTime = arguments.length > 0 ? arguments[0] : new Date();
return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] :
arguments);
}
return originalMockDate_1.apply(this, arguments);
};
// for auto go into fakeAsync feature, we need the flag to enable it
if (enableAutoFakeAsyncWhenClockPatched) {
['install', 'uninstall'].forEach(function (methodName) {
var originalClockFn = (clock[symbol(methodName)] = clock[methodName]);
clock[methodName] = function () {
var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec'];
if (FakeAsyncTestZoneSpec) {
jasmine[symbol('clockInstalled')] = 'install' === methodName;
return;
}
return originalClockFn.apply(this, arguments);
};
});
}
return originalMockDate_1.apply(this, arguments);
};
// for auto go into fakeAsync feature, we need the flag to enable it
if (enableClockPatch) {
['install', 'uninstall'].forEach(function (methodName) {
var originalClockFn = (clock[symbol(methodName)] = clock[methodName]);
clock[methodName] = function () {
var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec'];
if (FakeAsyncTestZoneSpec) {
jasmine[symbol('clockInstalled')] = 'install' === methodName;
return;
}
return originalClockFn.apply(this, arguments);
};
});
}
}
return clock;
};
return clock;
};
}
/**
* Gets a function wrapping the body of a Jasmine `describe` block to execute in a
* synchronous-only zone.
Expand All @@ -155,7 +163,7 @@
var isClockInstalled = !!jasmine[symbol('clockInstalled')];
var testProxyZoneSpec = queueRunner.testProxyZoneSpec;
var testProxyZone = queueRunner.testProxyZone;
if (isClockInstalled && enableClockPatch) {
if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) {
// auto run a fakeAsync
var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')];
if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') {
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.

0 comments on commit c555b08

Please sign in to comment.