* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
*
* @namespace
*/
varjasmine={};
if(isCommonJS)exports.jasmine=jasmine;
/**
* @private
*/
jasmine.unimplementedMethod_=function(){
thrownewError("unimplemented method");
};
/**
* Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code> is just
* a plain old variable and may be redefined by somebody else.
*
* @private
*/
jasmine.undefined=jasmine.___undefined___;
/**
* Show diagnostic messages in the console if set to true
*
*/
jasmine.VERBOSE=false;
/**
* Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
*
*/
jasmine.DEFAULT_UPDATE_INTERVAL=250;
/**
* Default timeout interval in milliseconds for waitsFor() blocks.
*/
jasmine.DEFAULT_TIMEOUT_INTERVAL=5000;
jasmine.getGlobal=function(){
functiongetGlobal(){
returnthis;
}
returngetGlobal();
};
/**
* Allows for bound functions to be compared. Internal use only.
*
* @ignore
* @private
* @param base {Object} bound 'this' for the function
mismatchValues.push("'"+property+"' was '"+(b[property]?jasmine.util.htmlEscape(b[property].toString()):b[property])+"' in expected, but was '"+(a[property]?jasmine.util.htmlEscape(a[property].toString()):a[property])+"' in actual.");
thrownewError('Expected a spy, but got '+jasmine.pp(this.actual)+'.');
}
this.message=function(){
if(this.actual.callCount===0){
// todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
return[
"Expected spy "+this.actual.identity+" to have been called with "+jasmine.pp(expectedArgs)+" but it was never called.",
"Expected spy "+this.actual.identity+" not to have been called with "+jasmine.pp(expectedArgs)+" but it was."
];
}else{
return[
"Expected spy "+this.actual.identity+" to have been called with "+jasmine.pp(expectedArgs)+" but was called with "+jasmine.pp(this.actual.argsForCall),
"Expected spy "+this.actual.identity+" not to have been called with "+jasmine.pp(expectedArgs)+" but was called with "+jasmine.pp(this.actual.argsForCall)
mismatchValues.push("'"+property+"' was '"+(other[property]?jasmine.util.htmlEscape(other[property].toString()):other[property])+"' in expected, but was '"+(this.sample[property]?jasmine.util.htmlEscape(this.sample[property].toString()):this.sample[property])+"' in actual.");
!function(i,g){"function"==typeofdefine&&"object"==typeofdefine.amd?define(g):this[i]=g()}("chai",function(){functioni(g){varh=i.resolve(g),e=i.modules[h];if(!e)throwError('failed to require "'+g+'"');e.exports||(e.exports={},e.call(e.exports,e,e.exports,i.relative(h)));returne.exports}i.modules={};i.resolve=function(g){varh=g+".js",e=g+"/index.js";returni.modules[h]&&h||i.modules[e]&&e||g};i.register=function(g,h){i.modules[g]=h};i.relative=function(g){returnfunction(h){if("."!=h[0])returni(h);
"to be been is and have with".split("").forEach(function(a){Object.defineProperty(c.prototype,a,{get:function(){returnthis},configurable:!0})});Object.defineProperty(c.prototype,"not",{get:function(){d(this,"negate",!0);returnthis},configurable:!0});Object.defineProperty(c.prototype,"deep",{get:function(){d(this,"deep",!0);returnthis},configurable:!0});g=function(){vara=function(a){varb=d(this,"object"),c=a.charAt(0).toUpperCase(),e=c+a.slice(1),c=~["A","E","I","O","U"].indexOf(c)?"an ":"a ";
this.assert("[object "+e+"]"===f.call(b),"expected #{this} to be "+c+a,"expected #{this} not to be "+c+a,"[object "+e+"]",f.call(b));returnthis};a.__proto__=this;returna};Object.defineProperty(c.prototype,"an",{get:g,configurable:!0});Object.defineProperty(c.prototype,"a",{get:g,configurable:!0});g=function(){d(this,"contains",!0);vara=function(a){this.assert(~d(this,"object").indexOf(a),"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a));returnthis};a.__proto__=
this;returna};Object.defineProperty(c.prototype,"contain",{get:g,configurable:!0});Object.defineProperty(c.prototype,"include",{get:g,configurable:!0});Object.defineProperty(c.prototype,"ok",{get:function(){this.assert(d(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy");returnthis},configurable:!0});Object.defineProperty(c.prototype,"true",{get:function(){this.assert(!0===d(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0);
returnthis},configurable:!0});Object.defineProperty(c.prototype,"false",{get:function(){this.assert(!1===d(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1);returnthis},configurable:!0});Object.defineProperty(c.prototype,"null",{get:function(){this.assert(null===d(this,"object"),"expected #{this} to be null","expected #{this} not to be null",this.negate?!1:!0);returnthis},configurable:!0});Object.defineProperty(c.prototype,"undefined",{get:function(){this.assert(void0===
d(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined",this.negate?!1:!0);returnthis},configurable:!0});Object.defineProperty(c.prototype,"exist",{get:function(){this.assert(null!=d(this,"object"),"expected #{this} to exist","expected #{this} to not exist");returnthis},configurable:!0});Object.defineProperty(c.prototype,"empty",{get:function(){vara=d(this,"object"),b=a;Array.isArray(a)||"string"===typeofobject?b=a.length:"object"===typeofa&&(b=Object.keys(a).length);
this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty");returnthis},configurable:!0});Object.defineProperty(c.prototype,"arguments",{get:function(){vara=d(this,"object");this.assert("[object Arguments]"==Object.prototype.toString.call(a),"expected #{this} to be arguments","expected #{this} to not be arguments","[object Arguments]",Object.prototype.toString.call(a));returnthis},configurable:!0});c.prototype.equal=function(a){varb=d(this,"object");d(this,"deep")?(newc(b)).to.eql(a):
this.assert(a===b,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a);returnthis};c.prototype.eql=function(a){this.assert(b.eql(a,d(this,"object")),"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a);returnthis};c.prototype.above=function(a){this.assert(d(this,"object")>a,"expected #{this} to be above "+a,"expected #{this} to be below "+a);returnthis};c.prototype.below=function(a){this.assert(d(this,"object")<a,"expected #{this} to be below "+a,
"expected #{this} to be above "+a);returnthis};c.prototype.within=function(a,b){varc=d(this,"object"),f=a+".."+b;this.assert(c>=a&&c<=b,"expected #{this} to be within "+f,"expected #{this} to not be within "+f);returnthis};c.prototype.instanceOf=function(a){varc=b.getName(a);this.assert(d(this,"object")instanceofa,"expected #{this} to be an instance of "+c,"expected #{this} to not be an instance of "+c);returnthis};c.prototype.property=function(a,c){varf=d(this,"object"),e=d(this,"deep")?b.getPathValue(a,
f):f[a],h=d(this,"deep")?"deep property ":"property ";if(d(this,"negate")&&void0!==c){if(void0===e)throwError(b.inspect(f)+" has no "+h+b.inspect(a));}elsethis.assert(void0!==e,"expected #{this} to have a "+h+b.inspect(a),"expected #{this} to not have "+h+b.inspect(a));void0!==c&&this.assert(c===e,"expected #{this} to have a "+h+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+h+b.inspect(a)+" of #{act}",c,e);d(this,"object",e);returnthis};c.prototype.ownProperty=
function(a){this.assert(d(this,"object").hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a));returnthis};c.prototype.length=function(a){varb=d(this,"object");(newc(b)).to.have.property("length");b=b.length;this.assert(b==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,b);returnthis};c.prototype.match=function(a){varb=d(this,"object");this.assert(a.exec(b),
"expected #{this} to match "+a,"expected #{this} not to match "+a);returnthis};c.prototype.string=function(a){varf=d(this,"object");(newc(f)).is.a("string");this.assert(~f.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a));returnthis};c.prototype.keys=function(a){varc=d(this,"object"),f,e=!0,a=ainstanceofArray?a:Array.prototype.slice.call(arguments);if(!a.length)throwError("keys required");varh=Object.keys(c),m=a.length,e=a.every(function(a){return~h.indexOf(a)});
!d(this,"negate")&&!d(this,"contains")&&(e=e&&a.length==h.length);1<m?(a=a.map(function(a){returnb.inspect(a)}),f=a.pop(),f=a.join(", ")+", and "+f):f=b.inspect(a[0]);f=(d(this,"contains")?"contain ":"have ")+((1<m?"keys ":"key ")+f);this.assert(e,"expected #{this} to "+f,"expected #{this} to not "+f,a,Object.keys(c));returnthis};c.prototype.Throw=function(a,f){vare=d(this,"object");(newc(e)).is.a("function");varh=!1,g=null,m=null;0===arguments.length?a=f=null:a&&(ainstanceofRegExp||"string"===
typeofa)?(f=a,a=null):a&&ainstanceofError?(g=a,f=a=null):"function"===typeofa?m=(newa).name:a=null;try{e()}catch(j){if(g)returnthis.assert(j===g,"expected #{this} to throw "+b.inspect(g)+" but "+b.inspect(j)+" was thrown","expected #{this} to not throw "+b.inspect(g)),this;if(a&&(this.assert(jinstanceofa,"expected #{this} to throw "+m+" but a "+j.name+" was thrown","expected #{this} to not throw "+m),!f))returnthis;if(j.message&&f&&finstanceofRegExp)returnthis.assert(f.exec(j.message),
"expected #{this} to throw error matching "+f+" but got "+b.inspect(j.message),"expected #{this} to throw error not matching "+f),this;if(j.message&&f&&"string"===typeoff)returnthis.assert(~j.message.indexOf(f),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",f,j.message),this;h=!0}e=m?m:g?b.inspect(g):"an error";this.assert(!0===h,"expected #{this} to throw "+e,"expected #{this} to not throw "+e);returnthis};c.prototype.respondTo=
function(a){varc=d(this,"object"),c="function"===typeofc?c.prototype[a]:c[a];this.assert("function"===typeofc,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a),"function",typeofc);returnthis};c.prototype.satisfy=function(a){varc=d(this,"object");this.assert(a(c),"expected #{this} to satisfy "+b.inspect(a),"expected #{this} to not satisfy"+b.inspect(a),this.negate?!1:!0,a(c));returnthis};c.prototype.closeTo=function(a,b){varc=d(this,"object");
this.assert(c-b===a||c+b===a,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b);returnthis};(functionn(b,d){c.prototype[d]=c.prototype[b];returnn})("equal","eq")("above","gt")("below","lt")("length","lengthOf")("keys","key")("ownProperty","haveOwnProperty")("above","greaterThan")("below","lessThan")("Throw","throws")("Throw","throw")("instanceOf","instanceof")});i.register("browser/error.js",function(g){functionh(e){e=e||{};this.message=e.message;
d)).is.ok};f.equal=function(b,d,a){a=newc(b,a);a.assert(d==g(a,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",d,b)};f.notEqual=function(b,d,a){a=newc(b,a);a.assert(d!=g(a,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",d,b)};f.strictEqual=function(b,d,a){(newc(b,a)).to.equal(d)};f.notStrictEqual=function(b,d,a){(newc(b,a)).to.not.equal(d)};f.deepEqual=function(b,d,a){(newc(b,a)).to.eql(d)};f.notDeepEqual=function(b,d,a){(newc(b,
e.inspect(b)+" to be "+d+""+e.inspect(a),"expected "+e.inspect(b)+" to not be "+d+""+e.inspect(a))};f.ifError=function(b,d){(newc(b,d)).to.not.be.ok};(functiond(a,c){f[c]=f[a];returnd})("Throw","throw")("Throw","throws")}});i.register("interface/expect.js",function(g){g.exports=function(h){h.expect=function(e,c){returnnewh.Assertion(e,c)}}});i.register("interface/should.js",function(g){g.exports=function(h){functione(){Object.defineProperty(Object.prototype,"should",{set:function(){},get:function(){returnthisinstanceof
(function(){functionj(i){vare=j.resolve(i),a=j.modules[e];if(!a)throwError('failed to require "'+i+'"');a.exports||(a.exports={},a.call(a.exports,a,a.exports,j.relative(e)));returna.exports}j.modules={};j.resolve=function(i){vare=i+".js",a=i+"/index.js";returnj.modules[e]&&e||j.modules[a]&&a||i};j.register=function(i,e){j.modules[i]=e};j.relative=function(i){returnfunction(e){if("."!=e.charAt(0))returnj(e);vara=i.split("/"),e=e.split("/");a.pop();for(varb=0;b<e.length;b++){varh=e[b];".."==
arguments.length)returnthis._timeout;h("timeout %d",a);this._timeout=a;this.timer&&this.resetTimeout();returnthis};b.prototype.fullTitle=function(){returnthis.parent.fullTitle()+""+this.title};b.prototype.clearTimeout=function(){clearTimeout(this.timer)};b.prototype.resetTimeout=function(){vara=this,d=this.timeout();this.clearTimeout();d&&(this.timer=setTimeout(function(){a.callback(Error("timeout of "+d+"ms exceeded"));a.timedOut=!0},d))};b.prototype.run=function(a){functiond(c){if(!f.timedOut){if(h){vard;
i?d=void0:(i=!0,f.emit("error",Error("done() called multiple times")));returnd}f.clearTimeout();f.duration=newDate-b;h=!0;a(c)}}varf=this,c=this.timeout(),b=newDate,e=this.ctx,h,i;this.async&&c&&(this.timer=setTimeout(function(){d(Error("timeout of "+c+"ms exceeded"));f.timedOut=!0},c));this.callback=d;if(this.async)try{this.fn.call(e,function(c){if(cinstanceofError)returnd(c);if(null!=c)returnd(Error("done() invoked with non-Error: "+c));d()})}catch(j){d(j)}elsetry{this.pending||this.fn.call(e),