Skip to content

Commit

Permalink
0.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Sep 25, 2015
1 parent ad5c0c8 commit 7ea2ab5
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions dist/jasmine-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ function apply() {
var originalIt = global.it;
var originalFit = global.fit;

// Patch jasmine `done()` and `done.fail()` so that they execute in the root zone
var patchJasmineDone = function(jasmineDone) {
var done = jasmineZone.bind(jasmineDone);
if (typeof jasmineDone.fail === 'function') {
done.fail = jasmineZone.bind(jasmineDone.fail);
}

return done;
}

global.it = function zoneResettingIt(description, specFn, timeOut) {
if (specFn.length) {
originalIt(description, function zoneResettingSpecFn(originalDone) {
specFn(function zoneResettingDone() {
jasmineZone.run(originalDone);
});
originalIt(description, function zoneResettingSpecFn(done) {
specFn(patchJasmineDone(done));
}, timeOut);
} else {
originalIt(description, specFn, timeOut);
Expand All @@ -36,10 +44,8 @@ function apply() {

global.fit = function zoneResettingFit(description, specFn, timeOut) {
if (specFn.length) {
originalFit(description, function zoneResettingSpecFn(originalDone) {
specFn(function zoneResettingDone() {
jasmineZone.run(originalDone);
});
originalFit(description, function zoneResettingSpecFn(done) {
specFn(patchJasmineDone(done));
}, timeOut);
} else {
originalFit(description, specFn, timeOut);
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.

7 changes: 5 additions & 2 deletions dist/zone-microtask.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,9 @@ function patchEventTargetMethods(obj) {
arguments[1] = handler[boundFnsKey][eventType];
}

return global.zone.addEventListener.apply(this, arguments);
var target = isWebWorker() && !this ? self : this;

return global.zone.addEventListener.apply(target, arguments);
};

// This is required for the removeEventListener hook on the root zone.
Expand All @@ -1075,7 +1077,8 @@ function patchEventTargetMethods(obj) {
arguments[1] = _bound[eventType];
delete _bound[eventType];
}
var result = global.zone.removeEventListener.apply(this, arguments);
var target = isWebWorker() && !this ? self : this;
var result = global.zone.removeEventListener.apply(target, arguments);
global.zone.dequeueTask(handler[originalFnKey]);
return result;
};
Expand Down
2 changes: 1 addition & 1 deletion dist/zone-microtask.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,9 @@ function patchEventTargetMethods(obj) {
arguments[1] = handler[boundFnsKey][eventType];
}

return global.zone.addEventListener.apply(this, arguments);
var target = isWebWorker() && !this ? self : this;

return global.zone.addEventListener.apply(target, arguments);
};

// This is required for the removeEventListener hook on the root zone.
Expand All @@ -1019,7 +1021,8 @@ function patchEventTargetMethods(obj) {
arguments[1] = _bound[eventType];
delete _bound[eventType];
}
var result = global.zone.removeEventListener.apply(this, arguments);
var target = isWebWorker() && !this ? self : this;
var result = global.zone.removeEventListener.apply(target, arguments);
global.zone.dequeueTask(handler[originalFnKey]);
return result;
};
Expand Down
Loading

0 comments on commit 7ea2ab5

Please sign in to comment.