12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- 'use strict';
- (function (factory) {
- typeof define === 'function' && define.amd ? define(factory) :
- factory();
- })((function () {
- 'use strict';
-
- Zone.__load_patch('promisefortest', function (global, Zone, api) {
- var symbolState = api.symbol('state');
- var UNRESOLVED = null;
- var symbolParentUnresolved = api.symbol('parentUnresolved');
-
-
-
-
-
-
-
- Promise[api.symbol('patchPromiseForTest')] = function patchPromiseForTest() {
- var oriThen = Promise[Zone.__symbol__('ZonePromiseThen')];
- if (oriThen) {
- return;
- }
- oriThen = Promise[Zone.__symbol__('ZonePromiseThen')] = Promise.prototype.then;
- Promise.prototype.then = function () {
- var chained = oriThen.apply(this, arguments);
- if (this[symbolState] === UNRESOLVED) {
-
- var asyncTestZoneSpec = Zone.current.get('AsyncTestZoneSpec');
- if (asyncTestZoneSpec) {
- asyncTestZoneSpec.unresolvedChainedPromiseCount++;
- chained[symbolParentUnresolved] = true;
- }
- }
- return chained;
- };
- };
- Promise[api.symbol('unPatchPromiseForTest')] = function unpatchPromiseForTest() {
-
- var oriThen = Promise[Zone.__symbol__('ZonePromiseThen')];
- if (oriThen) {
- Promise.prototype.then = oriThen;
- Promise[Zone.__symbol__('ZonePromiseThen')] = undefined;
- }
- };
- });
- }));
|