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

Commit 389762c

Browse files
JiaLiPassionmhevery
authored andcommitted
fix(test): add flag to patch jasmine.clock, move fakeAsync/async into original bundle (#1067)
1 parent 7aebdbd commit 389762c

24 files changed

+483
-518
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ script:
4040
- node_modules/.bin/karma start karma-dist-sauce-selenium3-jasmine.conf.js --single-run
4141
- node_modules/.bin/karma start karma-build-sauce-selenium3-mocha.conf.js --single-run
4242
- node_modules/.bin/gulp test/node
43+
- node_modules/.bin/gulp test/node -no-patch-clock
4344
- node_modules/.bin/gulp test/bluebird
4445
- node simple-server.js 2>&1> server.log&
4546
- node ./test/webdriver/test.sauce.js
@@ -48,3 +49,4 @@ script:
4849
- node_modules/.bin/karma start karma-dist-sauce-jasmine3.conf.js --single-run
4950
- node_modules/.bin/karma start karma-build-sauce-selenium3-mocha.conf.js --single-run
5051
- node_modules/.bin/gulp test/node
52+
- node_modules/.bin/gulp test/node -no-patch-clock

dist/zone-async-testing.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

dist/zone-fake-async.js

Lines changed: 0 additions & 161 deletions
This file was deleted.

dist/zone-mix.js

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,16 @@ var Zone$1 = (function (global) {
643643
return global['Zone'] = Zone;
644644
})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
645645

646+
var __values = (undefined && undefined.__values) || function (o) {
647+
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
648+
if (m) return m.call(o);
649+
return {
650+
next: function () {
651+
if (o && i >= o.length) o = void 0;
652+
return { value: o && o[i++], done: !o };
653+
}
654+
};
655+
};
646656
Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
647657
var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
648658
var ObjectDefineProperty = Object.defineProperty;
@@ -916,14 +926,24 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
916926
function onReject(error) {
917927
promise && (promise = null || reject(error));
918928
}
919-
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
920-
var value = values_1[_i];
921-
if (!isThenable(value)) {
922-
value = this.resolve(value);
929+
try {
930+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
931+
var value = values_1_1.value;
932+
if (!isThenable(value)) {
933+
value = this.resolve(value);
934+
}
935+
value.then(onResolve, onReject);
936+
}
937+
}
938+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
939+
finally {
940+
try {
941+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
923942
}
924-
value.then(onResolve, onReject);
943+
finally { if (e_1) throw e_1.error; }
925944
}
926945
return promise;
946+
var e_1, _a;
927947
};
928948
ZoneAwarePromise.all = function (values) {
929949
var resolve;
@@ -934,23 +954,33 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
934954
});
935955
var count = 0;
936956
var resolvedValues = [];
937-
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
938-
var value = values_2[_i];
939-
if (!isThenable(value)) {
940-
value = this.resolve(value);
941-
}
942-
value.then((function (index) { return function (value) {
943-
resolvedValues[index] = value;
944-
count--;
945-
if (!count) {
946-
resolve(resolvedValues);
957+
try {
958+
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
959+
var value = values_2_1.value;
960+
if (!isThenable(value)) {
961+
value = this.resolve(value);
947962
}
948-
}; })(count), reject);
949-
count++;
963+
value.then((function (index) { return function (value) {
964+
resolvedValues[index] = value;
965+
count--;
966+
if (!count) {
967+
resolve(resolvedValues);
968+
}
969+
}; })(count), reject);
970+
count++;
971+
}
972+
}
973+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
974+
finally {
975+
try {
976+
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
977+
}
978+
finally { if (e_2) throw e_2.error; }
950979
}
951980
if (!count)
952981
resolve(resolvedValues);
953982
return promise;
983+
var e_2, _a;
954984
};
955985
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
956986
var chainPromise = new this.constructor(null);

0 commit comments

Comments
 (0)