|
| 1 | +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
| 2 | +var jasminePatch = require('../jasmine/patch'); |
| 3 | + |
| 4 | +jasminePatch.apply(); |
| 5 | + |
| 6 | +},{"../jasmine/patch":2}],2:[function(require,module,exports){ |
| 7 | +(function (global){ |
| 8 | +'use strict'; |
| 9 | +// Patch jasmine's it and fit functions so that the `done` callback always resets the zone |
| 10 | +// to the jasmine zone, which should be the root zone. (angular/zone.js#91) |
| 11 | + |
| 12 | +function apply() { |
| 13 | + if (!global.zone) { |
| 14 | + throw new Error('zone.js does not seem to be installed'); |
| 15 | + } |
| 16 | + |
| 17 | + if (!global.zone.isRootZone()) { |
| 18 | + throw new Error('The jasmine patch should be called from the root zone'); |
| 19 | + } |
| 20 | + |
| 21 | + var jasmineZone = global.zone; |
| 22 | + var originalIt = global.it; |
| 23 | + var originalFit = global.fit; |
| 24 | + |
| 25 | + global.it = function zoneResettingIt(description, specFn) { |
| 26 | + if (specFn.length) { |
| 27 | + originalIt(description, function zoneResettingSpecFn(originalDone) { |
| 28 | + specFn(function zoneResettingDone() { |
| 29 | + jasmineZone.run(originalDone); |
| 30 | + }); |
| 31 | + }); |
| 32 | + } else { |
| 33 | + originalIt(description, specFn); |
| 34 | + } |
| 35 | + }; |
| 36 | + |
| 37 | + global.fit = function zoneResettingFit(description, specFn) { |
| 38 | + if (specFn.length) { |
| 39 | + originalFit(description, function zoneResettingSpecFn(originalDone) { |
| 40 | + specFn(function zoneResettingDone() { |
| 41 | + jasmineZone.run(originalDone); |
| 42 | + }); |
| 43 | + }); |
| 44 | + } else { |
| 45 | + originalFit(description, specFn); |
| 46 | + } |
| 47 | + }; |
| 48 | + |
| 49 | + // global beforeEach to check if we always start from the root zone |
| 50 | + beforeEach(function() { |
| 51 | + expect(global.zone.isRootZone()).toBe(true); |
| 52 | + }); |
| 53 | +} |
| 54 | + |
| 55 | +if (global.jasmine) { |
| 56 | + module.exports = { |
| 57 | + apply: apply |
| 58 | + }; |
| 59 | +} else { |
| 60 | + module.exports = { |
| 61 | + apply: function() { } |
| 62 | + }; |
| 63 | +} |
| 64 | + |
| 65 | +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 66 | +},{}]},{},[1]); |
0 commit comments