1 /**
  2  * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
  3  *
  4  * @namespace
  5  */
  6 var jasmine = {};
  7 
  8 /**
  9  * @private
 10  */
 11 jasmine.unimplementedMethod_ = function() {
 12   throw new Error("unimplemented method");
 13 };
 14 
 15 /**
 16  * Large or small values here may result in slow test running & "Too much recursion" errors
 17  *
 18  */
 19 jasmine.UPDATE_INTERVAL = 250;
 20 
 21 /**
 22  * Allows for bound functions to be comapred.  Internal use only.
 23  *
 24  * @ignore
 25  * @private
 26  * @param base {Object} bound 'this' for the function
 27  * @param name {Function} function to find
 28  */
 29 jasmine.bindOriginal_ = function(base, name) {
 30   var original = base[name];
 31   return function() {
 32     if (original.apply) {
 33       return original.apply(base, arguments);
 34     } else {
 35       //IE support
 36       if (base == window) {
 37         return window[name].apply(window, arguments);
 38       }
 39     }
 40   };
 41 };
 42 
 43 jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
 44 jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout');
 45 jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
 46 jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
 47 
 48 jasmine.MessageResult = function(text) {
 49   this.type = 'MessageResult';
 50   this.text = text;
 51   this.trace = new Error(); // todo: test better
 52 };
 53 
 54 jasmine.ExpectationResult = function(params) {
 55   this.type = 'ExpectationResult';
 56   this.matcherName = params.matcherName;
 57   this.passed_ = params.passed;
 58   this.expected = params.expected;
 59   this.actual = params.actual;
 60 
 61   /** @deprecated */
 62   this.details = params.details;
 63   
 64   this.message = this.passed_ ? 'Passed.' : params.message;
 65   this.trace = this.passed_ ? '' : new Error(this.message);
 66 };
 67 
 68 jasmine.ExpectationResult.prototype.passed = function () {
 69   return this.passed_;
 70 };
 71 
 72 /**
 73  * Getter for the Jasmine environment. Ensures one gets created
 74  */
 75 jasmine.getEnv = function() {
 76   return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
 77 };
 78 
 79 /**
 80  * @ignore
 81  * @private
 82  * @param value
 83  * @returns {Boolean}
 84  */
 85 jasmine.isArray_ = function(value) {
 86   return value &&
 87          typeof value === 'object' &&
 88          typeof value.length === 'number' &&
 89          typeof value.splice === 'function' &&
 90          !(value.propertyIsEnumerable('length'));
 91 };
 92 
 93 /**
 94  * Pretty printer for expecations.  Takes any object and turns it into a human-readable string.
 95  *
 96  * @param value {Object} an object to be outputted
 97  * @returns {String}
 98  */
 99 jasmine.pp = function(value) {
100   var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
101   stringPrettyPrinter.format(value);
102   return stringPrettyPrinter.string;
103 };
104 
105 /**
106  * Returns true if the object is a DOM Node.
107  *
108  * @param {Object} obj object to check
109  * @returns {Boolean}
110  */
111 jasmine.isDomNode = function(obj) {
112   return obj['nodeType'] > 0;
113 };
114 
115 /**
116  * Returns a matchable 'generic' object of the class type.  For use in expecations of type when values don't matter.
117  *
118  * @example
119  * // don't care about which function is passed in, as long as it's a function
120  * expect(mySpy).wasCalledWith(jasmine.any(Function));
121  *
122  * @param {Class} clazz
123  * @returns matchable object of the type clazz
124  */
125 jasmine.any = function(clazz) {
126   return new jasmine.Matchers.Any(clazz);
127 };
128 
129 /**
130  * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
131  *
132  * Spies should be created in test setup, before expectations.  They can then be checked, using the standard Jasmine
133  * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
134  *
135  * A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
136  * Spies are torn down at the end of every spec.
137  *
138  * Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
139  *
140  * @example
141  * // a stub
142  * var myStub = jasmine.createSpy('myStub');  // can be used anywhere
143  *
144  * // spy example
145  * var foo = {
146  *   not: function(bool) { return !bool; }
147  * }
148  *
149  * // actual foo.not will not be called, execution stops
150  * spyOn(foo, 'not');
151 
152  // foo.not spied upon, execution will continue to implementation
153  * spyOn(foo, 'not').andCallThrough();
154  *
155  * // fake example
156  * var foo = {
157  *   not: function(bool) { return !bool; }
158  * }
159  *
160  * // foo.not(val) will return val
161  * spyOn(foo, 'not').andCallFake(function(value) {return value;});
162  *
163  * // mock example
164  * foo.not(7 == 7);
165  * expect(foo.not).wasCalled();
166  * expect(foo.not).wasCalledWith(true);
167  *
168  * @constructor
169  * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
170  * @param {String} name
171  */
172 jasmine.Spy = function(name) {
173   /**
174    * The name of the spy, if provided.
175    */
176   this.identity = name || 'unknown';
177   /**
178    *  Is this Object a spy?
179    */
180   this.isSpy = true;
181   /**
182    * The acutal function this spy stubs.
183    */
184   this.plan = function() {
185   };
186   /**
187    * Tracking of the most recent call to the spy.
188    * @example
189    * var mySpy = jasmine.createSpy('foo');
190    * mySpy(1, 2);
191    * mySpy.mostRecentCall.args = [1, 2];
192    */
193   this.mostRecentCall = {};
194 
195   /**
196    * Holds arguments for each call to the spy, indexed by call count
197    * @example
198    * var mySpy = jasmine.createSpy('foo');
199    * mySpy(1, 2);
200    * mySpy(7, 8);
201    * mySpy.mostRecentCall.args = [7, 8];
202    * mySpy.argsForCall[0] = [1, 2];
203    * mySpy.argsForCall[1] = [7, 8];
204    */
205   this.argsForCall = [];
206   this.calls = [];
207 };
208 
209 /**
210  * Tells a spy to call through to the actual implemenatation.
211  *
212  * @example
213  * var foo = {
214  *   bar: function() { // do some stuff }
215  * }
216  *
217  * // defining a spy on an existing property: foo.bar
218  * spyOn(foo, 'bar').andCallThrough();
219  */
220 jasmine.Spy.prototype.andCallThrough = function() {
221   this.plan = this.originalValue;
222   return this;
223 };
224 
225 /**
226  * For setting the return value of a spy.
227  *
228  * @example
229  * // defining a spy from scratch: foo() returns 'baz'
230  * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
231  *
232  * // defining a spy on an existing property: foo.bar() returns 'baz'
233  * spyOn(foo, 'bar').andReturn('baz');
234  *
235  * @param {Object} value
236  */
237 jasmine.Spy.prototype.andReturn = function(value) {
238   this.plan = function() {
239     return value;
240   };
241   return this;
242 };
243 
244 /**
245  * For throwing an exception when a spy is called.
246  *
247  * @example
248  * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
249  * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
250  *
251  * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
252  * spyOn(foo, 'bar').andThrow('baz');
253  *
254  * @param {String} exceptionMsg
255  */
256 jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
257   this.plan = function() {
258     throw exceptionMsg;
259   };
260   return this;
261 };
262 
263 /**
264  * Calls an alternate implementation when a spy is called.
265  *
266  * @example
267  * var baz = function() {
268  *   // do some stuff, return something
269  * }
270  * // defining a spy from scratch: foo() calls the function baz
271  * var foo = jasmine.createSpy('spy on foo').andCall(baz);
272  *
273  * // defining a spy on an existing property: foo.bar() calls an anonymnous function
274  * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
275  *
276  * @param {Function} fakeFunc
277  */
278 jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
279   this.plan = fakeFunc;
280   return this;
281 };
282 
283 /**
284  * Resets all of a spy's the tracking variables so that it can be used again.
285  *
286  * @example
287  * spyOn(foo, 'bar');
288  *
289  * foo.bar();
290  *
291  * expect(foo.bar.callCount).toEqual(1);
292  *
293  * foo.bar.reset();
294  *
295  * expect(foo.bar.callCount).toEqual(0);
296  */
297 jasmine.Spy.prototype.reset = function() {
298   this.wasCalled = false;
299   this.callCount = 0;
300   this.argsForCall = [];
301   this.calls = [];
302   this.mostRecentCall = {};
303 };
304 
305 jasmine.createSpy = function(name) {
306 
307   var spyObj = function() {
308     spyObj.wasCalled = true;
309     spyObj.callCount++;
310     var args = jasmine.util.argsToArray(arguments);
311     spyObj.mostRecentCall.object = this;
312     spyObj.mostRecentCall.args = args;
313     spyObj.argsForCall.push(args);
314     spyObj.calls.push({object: this, args: args});
315     return spyObj.plan.apply(this, arguments);
316   };
317 
318   var spy = new jasmine.Spy(name);
319 
320   for (var prop in spy) {
321     spyObj[prop] = spy[prop];
322   }
323 
324   spyObj.reset();
325 
326   return spyObj;
327 };
328 
329 /**
330  * Creates a more complicated spy: an Object that has every property a function that is a spy.  Used for stubbing something
331  * large in one call.
332  *
333  * @param {String} baseName name of spy class
334  * @param {Array} methodNames array of names of methods to make spies
335  */
336 jasmine.createSpyObj = function(baseName, methodNames) {
337   var obj = {};
338   for (var i = 0; i < methodNames.length; i++) {
339     obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
340   }
341   return obj;
342 };
343 
344 jasmine.log = function(message) {
345   jasmine.getEnv().currentSpec.log(message);
346 };
347 
348 /**
349  * Function that installs a spy on an existing object's method name.  Used within a Spec to create a spy.
350  *
351  * @example
352  * // spy example
353  * var foo = {
354  *   not: function(bool) { return !bool; }
355  * }
356  * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
357  *
358  * @see jasmine.createSpy
359  * @param obj
360  * @param methodName
361  * @returns a Jasmine spy that can be chained with all spy methods
362  */
363 var spyOn = function(obj, methodName) {
364   return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
365 };
366 
367 /**
368  * Creates a Jasmine spec that will be added to the current suite.
369  *
370  * // TODO: pending tests
371  *
372  * @example
373  * it('should be true', function() {
374  *   expect(true).toEqual(true);
375  * });
376  *
377  * @param {String} desc description of this specification
378  * @param {Function} func defines the preconditions and expectations of the spec
379  */
380 var it = function(desc, func) {
381   return jasmine.getEnv().it(desc, func);
382 };
383 
384 /**
385  * Creates a <em>disabled</em> Jasmine spec.
386  *
387  * A convenience method that allows existing specs to be disabled temporarily during development.
388  *
389  * @param {String} desc description of this specification
390  * @param {Function} func defines the preconditions and expectations of the spec
391  */
392 var xit = function(desc, func) {
393   return jasmine.getEnv().xit(desc, func);
394 };
395 
396 /**
397  * Starts a chain for a Jasmine expectation.
398  *
399  * It is passed an Object that is the actual value and should chain to one of the many
400  * jasmine.Matchers functions.
401  *
402  * @param {Object} actual Actual value to test against and expected value
403  */
404 var expect = function(actual) {
405   return jasmine.getEnv().currentSpec.expect(actual);
406 };
407 
408 /**
409  * Defines part of a jasmine spec.  Used in cominbination with waits or waitsFor in asynchrnous specs.
410  *
411  * @param {Function} func Function that defines part of a jasmine spec.
412  */
413 var runs = function(func) {
414   jasmine.getEnv().currentSpec.runs(func);
415 };
416 
417 /**
418  * Waits for a timeout before moving to the next runs()-defined block.
419  * @param {Number} timeout
420  */
421 var waits = function(timeout) {
422   jasmine.getEnv().currentSpec.waits(timeout);
423 };
424 
425 /**
426  * Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
427  *
428  * @param {Number} timeout
429  * @param {Function} latchFunction
430  * @param {String} message
431  */
432 var waitsFor = function(timeout, latchFunction, message) {
433   jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message);
434 };
435 
436 /**
437  * A function that is called before each spec in a suite.
438  *
439  * Used for spec setup, including validating assumptions.
440  *
441  * @param {Function} beforeEachFunction
442  */
443 var beforeEach = function(beforeEachFunction) {
444   jasmine.getEnv().beforeEach(beforeEachFunction);
445 };
446 
447 /**
448  * A function that is called after each spec in a suite.
449  *
450  * Used for restoring any state that is hijacked during spec execution.
451  *
452  * @param {Function} afterEachFunction
453  */
454 var afterEach = function(afterEachFunction) {
455   jasmine.getEnv().afterEach(afterEachFunction);
456 };
457 
458 /**
459  * Defines a suite of specifications.
460  *
461  * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
462  * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
463  * of setup in some tests.
464  *
465  * @example
466  * // TODO: a simple suite
467  *
468  * // TODO: a simple suite with a nested describe block
469  *
470  * @param {String} description A string, usually the class under test.
471  * @param {Function} specDefinitions function that defines several specs.
472  */
473 var describe = function(description, specDefinitions) {
474   return jasmine.getEnv().describe(description, specDefinitions);
475 };
476 
477 /**
478  * Disables a suite of specifications.  Used to disable some suites in a file, or files, temporarily during development.
479  *
480  * @param {String} description A string, usually the class under test.
481  * @param {Function} specDefinitions function that defines several specs.
482  */
483 var xdescribe = function(description, specDefinitions) {
484   return jasmine.getEnv().xdescribe(description, specDefinitions);
485 };
486 
487 
488 jasmine.XmlHttpRequest = XMLHttpRequest;
489 
490 // Provide the XMLHttpRequest class for IE 5.x-6.x:
491 if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() {
492   try {
493     return new ActiveXObject("Msxml2.XMLHTTP.6.0");
494   } catch(e) {
495   }
496   try {
497     return new ActiveXObject("Msxml2.XMLHTTP.3.0");
498   } catch(e) {
499   }
500   try {
501     return new ActiveXObject("Msxml2.XMLHTTP");
502   } catch(e) {
503   }
504   try {
505     return new ActiveXObject("Microsoft.XMLHTTP");
506   } catch(e) {
507   }
508   throw new Error("This browser does not support XMLHttpRequest.");
509 };
510 
511 /**
512  * Adds suite files to an HTML document so that they are executed, thus adding them to the current
513  * Jasmine environment.
514  *
515  * @param {String} url path to the file to include
516  * @param {Boolean} opt_global
517  */
518 jasmine.include = function(url, opt_global) {
519   if (opt_global) {
520     document.write('<script type="text/javascript" src="' + url + '"></' + 'script>');
521   } else {
522     var xhr;
523     try {
524       xhr = new jasmine.XmlHttpRequest();
525       xhr.open("GET", url, false);
526       xhr.send(null);
527     } catch(e) {
528       throw new Error("couldn't fetch " + url + ": " + e);
529     }
530 
531     return eval(xhr.responseText);
532   }
533 };
534 
535 jasmine.version_= {
536   "major": 0,
537   "minor": 10,
538   "build": 0,
539   "revision": 1256860145
540   };
541 /**
542  * @namespace
543  */
544 jasmine.util = {};
545 
546 /**
547  * Declare that a child class inherite it's prototype from the parent class.
548  *
549  * @private
550  * @param {Function} childClass
551  * @param {Function} parentClass
552  */
553 jasmine.util.inherit = function(childClass, parentClass) {
554   var subclass = function() {
555   };
556   subclass.prototype = parentClass.prototype;
557   childClass.prototype = new subclass;
558 };
559 
560 jasmine.util.formatException = function(e) {
561   var lineNumber;
562   if (e.line) {
563     lineNumber = e.line;
564   }
565   else if (e.lineNumber) {
566     lineNumber = e.lineNumber;
567   }
568 
569   var file;
570 
571   if (e.sourceURL) {
572     file = e.sourceURL;
573   }
574   else if (e.fileName) {
575     file = e.fileName;
576   }
577 
578   var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
579 
580   if (file && lineNumber) {
581     message += ' in ' + file + ' (line ' + lineNumber + ')';
582   }
583 
584   return message;
585 };
586 
587 jasmine.util.htmlEscape = function(str) {
588   if (!str) return str;
589   return str.replace(/&/g, '&')
590     .replace(/</g, '<')
591     .replace(/>/g, '>');
592 };
593 
594 jasmine.util.argsToArray = function(args) {
595   var arrayOfArgs = [];
596   for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
597   return arrayOfArgs;
598 };
599 
600 jasmine.util.extend = function(destination, source) {
601   for (var property in source) destination[property] = source[property];
602   return destination;
603 };
604 
605 /**
606  * Environment for Jasmine
607  *
608  * @constructor
609  */
610 jasmine.Env = function() {
611   this.currentSpec = null;
612   this.currentSuite = null;
613   this.currentRunner_ = new jasmine.Runner(this);
614 
615   this.reporter = new jasmine.MultiReporter();
616 
617   this.updateInterval = jasmine.UPDATE_INTERVAL
618   this.lastUpdate = 0;
619   this.specFilter = function() {
620     return true;
621   };
622 
623   this.nextSpecId_ = 0;
624   this.nextSuiteId_ = 0;
625   this.equalityTesters_ = [];
626 };
627 
628 
629 jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
630 jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
631 jasmine.Env.prototype.setInterval = jasmine.setInterval;
632 jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
633 
634 /**
635  * @returns an object containing jasmine version build info, if set.
636  */
637 jasmine.Env.prototype.version = function () {
638   if (jasmine.version_) {
639     return jasmine.version_;
640   } else {
641     throw new Error('Version not set');
642   }
643 };
644 
645 /**
646  * @returns a sequential integer starting at 0
647  */
648 jasmine.Env.prototype.nextSpecId = function () {
649   return this.nextSpecId_++;
650 };
651 
652 /**
653  * @returns a sequential integer starting at 0
654  */
655 jasmine.Env.prototype.nextSuiteId = function () {
656   return this.nextSuiteId_++;
657 };
658 
659 /**
660  * Register a reporter to receive status updates from Jasmine.
661  * @param {jasmine.Reporter} reporter An object which will receive status updates.
662  */
663 jasmine.Env.prototype.addReporter = function(reporter) {
664   this.reporter.addReporter(reporter);
665 };
666 
667 jasmine.Env.prototype.execute = function() {
668   this.currentRunner_.execute();
669 };
670 
671 jasmine.Env.prototype.describe = function(description, specDefinitions) {
672   var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
673 
674   var parentSuite = this.currentSuite;
675   if (parentSuite) {
676     parentSuite.add(suite);
677   } else {
678     this.currentRunner_.add(suite);
679   }
680 
681   this.currentSuite = suite;
682 
683   specDefinitions.call(suite);
684 
685   this.currentSuite = parentSuite;
686 
687   return suite;
688 };
689 
690 jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
691   if (this.currentSuite) {
692     this.currentSuite.beforeEach(beforeEachFunction);
693   } else {
694     this.currentRunner_.beforeEach(beforeEachFunction);
695   }
696 };
697 
698 jasmine.Env.prototype.currentRunner = function () {
699   return this.currentRunner_;
700 };
701 
702 jasmine.Env.prototype.afterEach = function(afterEachFunction) {
703   if (this.currentSuite) {
704     this.currentSuite.afterEach(afterEachFunction);
705   } else {
706     this.currentRunner_.afterEach(afterEachFunction);
707   }
708 
709 };
710 
711 jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
712   return {
713     execute: function() {
714     }
715   };
716 };
717 
718 jasmine.Env.prototype.it = function(description, func) {
719   var spec = new jasmine.Spec(this, this.currentSuite, description);
720   this.currentSuite.add(spec);
721   this.currentSpec = spec;
722 
723   if (func) {
724     spec.runs(func);
725   }
726 
727   return spec;
728 };
729 
730 jasmine.Env.prototype.xit = function(desc, func) {
731   return {
732     id: this.nextSpecId(),
733     runs: function() {
734     }
735   };
736 };
737 
738 jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
739   if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
740     return true;
741   }
742 
743   a.__Jasmine_been_here_before__ = b;
744   b.__Jasmine_been_here_before__ = a;
745 
746   var hasKey = function(obj, keyName) {
747     return obj != null && obj[keyName] !== undefined;
748   };
749 
750   for (var property in b) {
751     if (!hasKey(a, property) && hasKey(b, property)) {
752       mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
753     }
754   }
755   for (property in a) {
756     if (!hasKey(b, property) && hasKey(a, property)) {
757       mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
758     }
759   }
760   for (property in b) {
761     if (property == '__Jasmine_been_here_before__') continue;
762     if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
763       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.");
764     }
765   }
766 
767   if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
768     mismatchValues.push("arrays were not the same length");
769   }
770 
771   delete a.__Jasmine_been_here_before__;
772   delete b.__Jasmine_been_here_before__;
773   return (mismatchKeys.length == 0 && mismatchValues.length == 0);
774 };
775 
776 jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
777   mismatchKeys = mismatchKeys || [];
778   mismatchValues = mismatchValues || [];
779 
780   if (a === b) return true;
781 
782   if (a === undefined || a === null || b === undefined || b === null) {
783     return (a == undefined && b == undefined);
784   }
785 
786   if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
787     return a === b;
788   }
789 
790   if (a instanceof Date && b instanceof Date) {
791     return a.getTime() == b.getTime();
792   }
793 
794   if (a instanceof jasmine.Matchers.Any) {
795     return a.matches(b);
796   }
797 
798   if (b instanceof jasmine.Matchers.Any) {
799     return b.matches(a);
800   }
801 
802   if (typeof a === "object" && typeof b === "object") {
803     return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
804   }
805 
806   for (var i = 0; i < this.equalityTesters_.length; i++) {
807     var equalityTester = this.equalityTesters_[i];
808     var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
809     if (result !== undefined) return result;
810   }
811 
812   //Straight check
813   return (a === b);
814 };
815 
816 jasmine.Env.prototype.contains_ = function(haystack, needle) {
817   if (jasmine.isArray_(haystack)) {
818     for (var i = 0; i < haystack.length; i++) {
819       if (this.equals_(haystack[i], needle)) return true;
820     }
821     return false;
822   }
823   return haystack.indexOf(needle) >= 0;
824 };
825 
826 jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
827   this.equalityTesters_.push(equalityTester);
828 };
829 /** No-op base class for Jasmine reporters.
830  *
831  * @constructor
832  */
833 jasmine.Reporter = function() {
834 };
835 
836 //noinspection JSUnusedLocalSymbols
837 jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
838 };
839 
840 //noinspection JSUnusedLocalSymbols
841 jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
842 };
843 
844 //noinspection JSUnusedLocalSymbols
845 jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
846 };
847 
848 //noinspection JSUnusedLocalSymbols
849 jasmine.Reporter.prototype.reportSpecResults = function(spec) {
850 };
851 
852 //noinspection JSUnusedLocalSymbols
853 jasmine.Reporter.prototype.log = function(str) {
854 };
855 
856 /**
857  * Blocks are functions with executable code that make up a spec.
858  *
859  * @constructor
860  * @param {jasmine.Env} env
861  * @param {Function} func
862  * @param {jasmine.Spec} spec
863  */
864 jasmine.Block = function(env, func, spec) {
865   this.env = env;
866   this.func = func;
867   this.spec = spec;
868 };
869 
870 jasmine.Block.prototype.execute = function(onComplete) {  
871   try {
872     this.func.apply(this.spec);
873   } catch (e) {
874     this.spec.fail(e);
875   }
876   onComplete();
877 };
878 /** JavaScript API reporter.
879  *
880  * @constructor
881  */
882 jasmine.JsApiReporter = function() {
883   this.started = false;
884   this.finished = false;
885   this.suites_ = [];
886   this.results_ = {};
887 };
888 
889 jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
890   this.started = true;
891   var suites = runner.suites();
892   for (var i = 0; i < suites.length; i++) {
893     var suite = suites[i];
894     this.suites_.push(this.summarize_(suite));
895   }
896 };
897 
898 jasmine.JsApiReporter.prototype.suites = function() {
899   return this.suites_;
900 };
901 
902 jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
903   var isSuite = suiteOrSpec instanceof jasmine.Suite
904   var summary = {
905     id: suiteOrSpec.id,
906     name: suiteOrSpec.description,
907     type: isSuite ? 'suite' : 'spec',
908     children: []
909   };
910   if (isSuite) {
911     var specs = suiteOrSpec.specs();
912     for (var i = 0; i < specs.length; i++) {
913       summary.children.push(this.summarize_(specs[i]));
914     }
915   }
916   return summary;
917 };
918 
919 jasmine.JsApiReporter.prototype.results = function() {
920   return this.results_;
921 };
922 
923 jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
924   return this.results_[specId];
925 };
926 
927 //noinspection JSUnusedLocalSymbols
928 jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
929   this.finished = true;
930 };
931 
932 //noinspection JSUnusedLocalSymbols
933 jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
934 };
935 
936 //noinspection JSUnusedLocalSymbols
937 jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
938   this.results_[spec.id] = {
939     messages: spec.results().getItems(),
940     result: spec.results().failedCount > 0 ? "failed" : "passed"
941   };
942 };
943 
944 //noinspection JSUnusedLocalSymbols
945 jasmine.JsApiReporter.prototype.log = function(str) {
946 };
947 
948 jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
949   var results = {};
950   for (var i = 0; i < specIds.length; i++) {
951     var specId = specIds[i];
952     results[specId] = this.summarizeResult_(this.results_[specId]);
953   }
954   return results;
955 };
956 
957 jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
958   var summaryMessages = [];
959   for (var messageIndex in result.messages) {
960     var resultMessage = result.messages[messageIndex];
961     summaryMessages.push({
962       text: resultMessage.text,
963       passed: resultMessage.passed ? resultMessage.passed() : true,
964       type: resultMessage.type,
965       message: resultMessage.message,
966       trace: {
967         stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined
968       }
969     });
970   };
971 
972   var summaryResult = {
973     result : result.result,
974     messages : summaryMessages
975   };
976 
977   return summaryResult;
978 };
979 
980 /**
981  * @constructor
982  * @param {jasmine.Env} env
983  * @param actual
984  * @param {jasmine.NestedResults} results
985  */
986 jasmine.Matchers = function(env, actual, spec) {
987   this.env = env;
988   this.actual = actual;
989   this.spec = spec;
990 };
991 
992 jasmine.Matchers.pp = function(str) {
993   return jasmine.util.htmlEscape(jasmine.pp(str));
994 };
995 
996 jasmine.Matchers.prototype.report = function(result, failing_message, details) {
997   var expectationResult = new jasmine.ExpectationResult({
998     passed: result,
999     message: failing_message,
1000     details: details
1001   });
1002   this.spec.addMatcherResult(expectationResult);
1003   return result;
1004 };
1005 
1006 /**
1007  * Matcher that compares the actual to the expected using ===.
1008  *
1009  * @param expected
1010  */
1011 
1012 
1013 jasmine.Matchers.addMatcher = function(matcherName, options) {
1014   jasmine.Matchers.prototype[matcherName] = function () {
1015     jasmine.util.extend(this, options);
1016     var expected = jasmine.util.argsToArray(arguments);
1017     var args = [this.actual].concat(expected);
1018     var result = options.test.apply(this, args);
1019     var message;
1020     if (!result) {
1021       message = options.message.apply(this, args);
1022     }
1023     var expectationResult = new jasmine.ExpectationResult({
1024       matcherName: matcherName,
1025       passed: result,
1026       expected: expected,
1027       actual: this.actual,
1028       message: message
1029     });
1030     this.spec.addMatcherResult(expectationResult);
1031     return result;
1032   };
1033 };
1034 
1035 
1036 /**
1037  * toBe: compares the actual to the expected using ===
1038  * @param expected
1039  */
1040 
1041 jasmine.Matchers.addMatcher('toBe', {
1042   test: function (actual, expected) {
1043     return actual === expected;
1044   },
1045   message: function(actual, expected) {
1046     return "Expected " + jasmine.pp(actual) + " to be " + jasmine.pp(expected);
1047   }
1048 });
1049 
1050 /**
1051  * toNotBe: compares the actual to the expected using !==
1052  * @param expected
1053  */
1054 jasmine.Matchers.addMatcher('toNotBe', {
1055   test: function (actual, expected) {
1056     return actual !== expected;
1057   },
1058   message: function(actual, expected) {
1059     return "Expected " + jasmine.pp(actual) + " to not be " + jasmine.pp(expected);
1060   }
1061 });
1062 
1063 /**
1064  * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
1065  *
1066  * @param expected
1067  */
1068 
1069 jasmine.Matchers.addMatcher('toEqual', {
1070   test: function (actual, expected) {
1071     return this.env.equals_(actual, expected);
1072   },
1073   message: function(actual, expected) {
1074     return "Expected " + jasmine.pp(actual) + " to equal " + jasmine.pp(expected);
1075   }
1076 });
1077 
1078 /**
1079  * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
1080  * @param expected
1081  */
1082 jasmine.Matchers.addMatcher('toNotEqual', {
1083   test: function (actual, expected) {
1084     return !this.env.equals_(actual, expected);
1085   },
1086   message: function(actual, expected) {
1087     return "Expected " + jasmine.pp(actual) + " to not equal " + jasmine.pp(expected);
1088   }
1089 });
1090 
1091 /**
1092  * Matcher that compares the actual to the expected using a regular expression.  Constructs a RegExp, so takes
1093  * a pattern or a String.
1094  *
1095  * @param reg_exp
1096  */
1097 jasmine.Matchers.addMatcher('toMatch', {
1098   test: function(actual, expected) {
1099     return new RegExp(expected).test(actual);
1100   },
1101   message: function(actual, expected) {
1102     return actual + " does not match the regular expression " + new RegExp(expected).toString();
1103   }
1104 });
1105 
1106 /**
1107  * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
1108  * @param reg_exp
1109  */
1110 
1111 jasmine.Matchers.addMatcher('toNotMatch', {
1112   test: function(actual, expected) {
1113     return !(new RegExp(expected).test(actual));
1114   },
1115   message: function(actual, expected) {
1116     return actual + " should not match " + new RegExp(expected).toString();
1117   }
1118 });
1119 
1120 /**
1121  * Matcher that compares the acutal to undefined.
1122  */
1123 
1124 jasmine.Matchers.addMatcher('toBeDefined', {
1125   test: function(actual) {
1126     return (actual !== undefined);
1127   },
1128   message: function() {
1129     return 'Expected actual to not be undefined.';
1130   }
1131 });
1132 
1133 /**
1134  * Matcher that compares the acutal to undefined.
1135  */
1136 
1137 jasmine.Matchers.addMatcher('toBeUndefined', {
1138   test: function(actual) {
1139     return (actual === undefined);
1140   },
1141   message: function(actual) {
1142     return 'Expected ' + jasmine.pp(actual) + ' to be undefined.';
1143   }
1144 });
1145 
1146 /**
1147  * Matcher that compares the actual to null.
1148  *
1149  */
1150 jasmine.Matchers.addMatcher('toBeNull', {
1151   test: function(actual) {
1152     return (actual === null);
1153   },
1154   message: function(actual) {
1155     return 'Expected ' + jasmine.pp(actual) + ' to be null.';
1156   }
1157 });
1158 
1159 /**
1160  * Matcher that boolean not-nots the actual.
1161  */
1162 jasmine.Matchers.addMatcher('toBeTruthy', {
1163   test: function(actual) {
1164     return !!actual;
1165   },
1166   message: function() {
1167     return 'Expected actual to be truthy';
1168   }
1169 });
1170 
1171 
1172 /**
1173  * Matcher that boolean nots the actual.
1174  */
1175 jasmine.Matchers.addMatcher('toBeFalsy', {
1176   test: function(actual) {
1177     return !actual;
1178   },
1179   message: function(actual) {
1180     return 'Expected ' + jasmine.pp(actual) + ' to be falsy';
1181   }
1182 });
1183 
1184 /**
1185  * Matcher that checks to see if the acutal, a Jasmine spy, was called.
1186  */
1187 
1188 jasmine.Matchers.addMatcher('wasCalled', {
1189   test: function() {
1190     var args = jasmine.util.argsToArray(arguments);
1191     if (args.length > 1) {
1192       throw(new Error('wasCalled does not take arguments, use wasCalledWith'));
1193     }
1194     var actual = args.splice(0, 1)[0];    
1195     if (!actual || !actual.isSpy) {
1196       return false;
1197     }
1198     return actual.wasCalled;
1199   },
1200   message: function() {
1201     var args = jasmine.util.argsToArray(arguments);
1202     var actual = args.splice(0, 1)[0];
1203     var message;
1204     if (!actual || !actual.isSpy) {
1205       message = 'Actual is not a spy.';
1206     } else {
1207       message = "Expected spy " + actual.identity + " to have been called.";
1208     }
1209     return message;
1210   }
1211 });
1212 
1213 /**
1214  * Matcher that checks to see if the acutal, a Jasmine spy, was not called.
1215  */
1216 jasmine.Matchers.addMatcher('wasNotCalled', {
1217   test: function() {
1218     var args = jasmine.util.argsToArray(arguments);
1219     var actual = args.splice(0, 1)[0];
1220     if (!actual || !actual.isSpy) {
1221       return false;
1222     }
1223     return !actual.wasCalled;
1224   },
1225   message: function() {
1226     var args = jasmine.util.argsToArray(arguments);
1227     var actual = args.splice(0, 1)[0];
1228     var message;
1229     if (!actual || !actual.isSpy) {
1230       message = 'Actual is not a spy.';
1231     } else {
1232       message = "Expected spy " + actual.identity + " to not have been called.";
1233     }
1234     return message;
1235   }
1236 });
1237 
1238 jasmine.Matchers.addMatcher('wasCalledWith', {
1239   test: function() {
1240     var args = jasmine.util.argsToArray(arguments);
1241     var actual = args.splice(0, 1)[0];
1242     if (!actual || !actual.isSpy) {
1243       return false;
1244     }
1245     return this.env.contains_(actual.argsForCall, args);
1246   },
1247   message: function() {
1248     var args = jasmine.util.argsToArray(arguments);
1249     var actual = args.splice(0, 1)[0];
1250     var message;
1251     if (!actual || !actual.isSpy) {
1252       message = 'Actual is not a spy';
1253     } else {
1254       message = "Expected spy to have been called with " + jasmine.pp(args) + " but was called with " + actual.argsForCall;
1255     }
1256     return message;
1257   }
1258 });
1259 
1260 /**
1261  * Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
1262  *
1263  * @example
1264  *
1265  */
1266 
1267 /**
1268  * Matcher that checks that the expected item is an element in the actual Array.
1269  *
1270  * @param {Object} item
1271  */
1272 
1273 jasmine.Matchers.addMatcher('toContain', {
1274   test: function(actual, expected) {
1275     return this.env.contains_(actual, expected);
1276   },
1277   message: function(actual, expected) {
1278     return 'Expected ' + jasmine.pp(actual) + ' to contain ' + jasmine.pp(expected);
1279   }
1280 });
1281 
1282 /**
1283  * Matcher that checks that the expected item is NOT an element in the actual Array.
1284  *
1285  * @param {Object} item
1286  */
1287 jasmine.Matchers.addMatcher('toNotContain', {
1288   test: function(actual, expected) {
1289     return !this.env.contains_(actual, expected);
1290   },
1291   message: function(actual, expected) {
1292     return 'Expected ' + jasmine.pp(actual) + ' to not contain ' + jasmine.pp(expected);
1293   }
1294 });
1295 
1296 jasmine.Matchers.addMatcher('toBeLessThan', {
1297   test: function(actual, expected) {
1298     return actual < expected;
1299   },
1300   message: function(actual, expected) {
1301     return 'Expected ' + jasmine.pp(actual) + ' to be less than ' + jasmine.pp(expected);
1302   }
1303 });
1304 
1305 jasmine.Matchers.addMatcher('toBeGreaterThan', {
1306   test: function(actual, expected) {
1307     return actual > expected;
1308   },
1309   message: function(actual, expected) {
1310     return 'Expected ' + jasmine.pp(actual) + ' to be greater than ' + jasmine.pp(expected);
1311   }
1312 });
1313 
1314 /**
1315  * Matcher that checks that the expected exception was thrown by the actual.
1316  *
1317  * @param {String} expectedException
1318  */
1319 jasmine.Matchers.addMatcher('toThrow', {
1320   getException_: function(actual, expected) {
1321     var exception;
1322     if (typeof actual != 'function') {
1323       throw new Error('Actual is not a function');
1324     }
1325     try {
1326       actual();
1327     } catch (e) {
1328       exception = e;
1329     }
1330     return exception;
1331   },
1332   test: function(actual, expected) {
1333     var result = false;
1334     var exception = this.getException_(actual, expected);
1335     if (exception) {
1336       result = (expected === undefined || this.env.equals_(exception.message || exception, expected.message || expected));
1337     }
1338     return result;
1339   },
1340   message: function(actual, expected) {
1341     var exception = this.getException_(actual, expected);
1342     if (exception && (expected === undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
1343       return ["Expected function to throw", expected.message || expected, ", but it threw", exception.message || exception  ].join(' ');      
1344     } else {
1345       return "Expected function to throw an exception.";
1346     }
1347   }
1348 });
1349 
1350 jasmine.Matchers.Any = function(expectedClass) {
1351   this.expectedClass = expectedClass;
1352 };
1353 
1354 jasmine.Matchers.Any.prototype.matches = function(other) {
1355   if (this.expectedClass == String) {
1356     return typeof other == 'string' || other instanceof String;
1357   }
1358 
1359   if (this.expectedClass == Number) {
1360     return typeof other == 'number' || other instanceof Number;
1361   }
1362 
1363   if (this.expectedClass == Function) {
1364     return typeof other == 'function' || other instanceof Function;
1365   }
1366 
1367   if (this.expectedClass == Object) {
1368     return typeof other == 'object';
1369   }
1370 
1371   return other instanceof this.expectedClass;
1372 };
1373 
1374 jasmine.Matchers.Any.prototype.toString = function() {
1375   return '<jasmine.any(' + this.expectedClass + ')>';
1376 };
1377 
1378 /**
1379  * @constructor
1380  */
1381 jasmine.MultiReporter = function() {
1382   this.subReporters_ = [];
1383 };
1384 jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
1385 
1386 jasmine.MultiReporter.prototype.addReporter = function(reporter) {
1387   this.subReporters_.push(reporter);
1388 };
1389 
1390 (function() {
1391   var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"];
1392   for (var i = 0; i < functionNames.length; i++) {
1393     var functionName = functionNames[i];
1394     jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
1395       return function() {
1396         for (var j = 0; j < this.subReporters_.length; j++) {
1397           var subReporter = this.subReporters_[j];
1398           if (subReporter[functionName]) {
1399             subReporter[functionName].apply(subReporter, arguments);
1400           }
1401         }
1402       };
1403     })(functionName);
1404   }
1405 })();
1406 /**
1407  * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
1408  *
1409  * @constructor
1410  */
1411 jasmine.NestedResults = function() {
1412   /**
1413    * The total count of results
1414    */
1415   this.totalCount = 0;
1416   /**
1417    * Number of passed results
1418    */
1419   this.passedCount = 0;
1420   /**
1421    * Number of failed results
1422    */
1423   this.failedCount = 0;
1424   /**
1425    * Was this suite/spec skipped?
1426    */
1427   this.skipped = false;
1428   /**
1429    * @ignore
1430    */
1431   this.items_ = [];
1432 };
1433 
1434 /**
1435  * Roll up the result counts.
1436  *
1437  * @param result
1438  */
1439 jasmine.NestedResults.prototype.rollupCounts = function(result) {
1440   this.totalCount += result.totalCount;
1441   this.passedCount += result.passedCount;
1442   this.failedCount += result.failedCount;
1443 };
1444 
1445 /**
1446  * Tracks a result's message.
1447  * @param message
1448  */
1449 jasmine.NestedResults.prototype.log = function(message) {
1450   this.items_.push(new jasmine.MessageResult(message));
1451 };
1452 
1453 /**
1454  * Getter for the results: message & results.
1455  */
1456 jasmine.NestedResults.prototype.getItems = function() {
1457   return this.items_;
1458 };
1459 
1460 /**
1461  * Adds a result, tracking counts (total, passed, & failed)
1462  * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
1463  */
1464 jasmine.NestedResults.prototype.addResult = function(result) {
1465   if (result.type != 'MessageResult') {
1466     if (result.items_) {
1467       this.rollupCounts(result);
1468     } else {
1469       this.totalCount++;
1470       if (result.passed()) {
1471         this.passedCount++;
1472       } else {
1473         this.failedCount++;
1474       }
1475     }
1476   }
1477   this.items_.push(result);
1478 };
1479 
1480 /**
1481  * @returns {Boolean} True if <b>everything</b> below passed
1482  */
1483 jasmine.NestedResults.prototype.passed = function() {
1484   return this.passedCount === this.totalCount;
1485 };
1486 /**
1487  * Base class for pretty printing for expectation results.
1488  */
1489 jasmine.PrettyPrinter = function() {
1490   this.ppNestLevel_ = 0;
1491 };
1492 
1493 /**
1494  * Formats a value in a nice, human-readable string.
1495  *
1496  * @param value
1497  * @returns {String}
1498  */
1499 jasmine.PrettyPrinter.prototype.format = function(value) {
1500   if (this.ppNestLevel_ > 40) {
1501     //    return '(jasmine.pp nested too deeply!)';
1502     throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
1503   }
1504 
1505   this.ppNestLevel_++;
1506   try {
1507     if (value === undefined) {
1508       this.emitScalar('undefined');
1509     } else if (value === null) {
1510       this.emitScalar('null');
1511     } else if (value.navigator && value.frames && value.setTimeout) {
1512       this.emitScalar('<window>');
1513     } else if (value instanceof jasmine.Matchers.Any) {
1514       this.emitScalar(value.toString());
1515     } else if (typeof value === 'string') {
1516       this.emitString(value);
1517     } else if (typeof value === 'function') {
1518       this.emitScalar('Function');
1519     } else if (typeof value.nodeType === 'number') {
1520       this.emitScalar('HTMLNode');
1521     } else if (value instanceof Date) {
1522       this.emitScalar('Date(' + value + ')');
1523     } else if (value.__Jasmine_been_here_before__) {
1524       this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
1525     } else if (jasmine.isArray_(value) || typeof value == 'object') {
1526       value.__Jasmine_been_here_before__ = true;
1527       if (jasmine.isArray_(value)) {
1528         this.emitArray(value);
1529       } else {
1530         this.emitObject(value);
1531       }
1532       delete value.__Jasmine_been_here_before__;
1533     } else {
1534       this.emitScalar(value.toString());
1535     }
1536   } finally {
1537     this.ppNestLevel_--;
1538   }
1539 };
1540 
1541 jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
1542   for (var property in obj) {
1543     if (property == '__Jasmine_been_here_before__') continue;
1544     fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
1545   }
1546 };
1547 
1548 jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
1549 jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
1550 jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
1551 jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
1552 
1553 jasmine.StringPrettyPrinter = function() {
1554   jasmine.PrettyPrinter.call(this);
1555 
1556   this.string = '';
1557 };
1558 jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
1559 
1560 jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
1561   this.append(value);
1562 };
1563 
1564 jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
1565   this.append("'" + value + "'");
1566 };
1567 
1568 jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
1569   this.append('[ ');
1570   for (var i = 0; i < array.length; i++) {
1571     if (i > 0) {
1572       this.append(', ');
1573     }
1574     this.format(array[i]);
1575   }
1576   this.append(' ]');
1577 };
1578 
1579 jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
1580   var self = this;
1581   this.append('{ ');
1582   var first = true;
1583 
1584   this.iterateObject(obj, function(property, isGetter) {
1585     if (first) {
1586       first = false;
1587     } else {
1588       self.append(', ');
1589     }
1590 
1591     self.append(property);
1592     self.append(' : ');
1593     if (isGetter) {
1594       self.append('<getter>');
1595     } else {
1596       self.format(obj[property]);
1597     }
1598   });
1599 
1600   this.append(' }');
1601 };
1602 
1603 jasmine.StringPrettyPrinter.prototype.append = function(value) {
1604   this.string += value;
1605 };
1606 jasmine.Queue = function(env) {
1607   this.env = env;
1608   this.blocks = [];
1609   this.running = false;
1610   this.index = 0;
1611   this.offset = 0;
1612 };
1613 
1614 jasmine.Queue.prototype.addBefore = function(block) {
1615   this.blocks.unshift(block);
1616 };
1617 
1618 jasmine.Queue.prototype.add = function(block) {
1619   this.blocks.push(block);
1620 };
1621 
1622 jasmine.Queue.prototype.insertNext = function(block) {
1623   this.blocks.splice((this.index + this.offset + 1), 0, block);
1624   this.offset++;
1625 };
1626 
1627 jasmine.Queue.prototype.start = function(onComplete) {
1628   this.running = true;
1629   this.onComplete = onComplete;
1630   this.next_();
1631 };
1632 
1633 jasmine.Queue.prototype.isRunning = function() {
1634   return this.running;
1635 };
1636 
1637 jasmine.Queue.LOOP_DONT_RECURSE = true;
1638 
1639 jasmine.Queue.prototype.next_ = function() {
1640   var self = this;
1641   var goAgain = true;
1642 
1643   while (goAgain) {
1644     goAgain = false;
1645     
1646     if (self.index < self.blocks.length) {
1647       var calledSynchronously = true;
1648       var completedSynchronously = false;
1649 
1650       var onComplete = function () {
1651         if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
1652           completedSynchronously = true;
1653           return;
1654         }
1655 
1656         self.offset = 0;
1657         self.index++;
1658 
1659         var now = new Date().getTime();
1660         if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
1661           self.env.lastUpdate = now;
1662           self.env.setTimeout(function() {
1663             self.next_();
1664           }, 0);
1665         } else {
1666           if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
1667             goAgain = true;
1668           } else {
1669             self.next_();
1670           }
1671         }
1672       };
1673       self.blocks[self.index].execute(onComplete);
1674 
1675       calledSynchronously = false;
1676       if (completedSynchronously) {
1677         onComplete();
1678       }
1679       
1680     } else {
1681       self.running = false;
1682       if (self.onComplete) {
1683         self.onComplete();
1684       }
1685     }
1686   }
1687 };
1688 
1689 jasmine.Queue.prototype.results = function() {
1690   var results = new jasmine.NestedResults();
1691   for (var i = 0; i < this.blocks.length; i++) {
1692     if (this.blocks[i].results) {
1693       results.addResult(this.blocks[i].results());
1694     }
1695   }
1696   return results;
1697 };
1698 
1699 
1700 /* JasmineReporters.reporter
1701  *    Base object that will get called whenever a Spec, Suite, or Runner is done.  It is up to
1702  *    descendants of this object to do something with the results (see json_reporter.js)
1703  */
1704 jasmine.Reporters = {};
1705 
1706 jasmine.Reporters.reporter = function(callbacks) {
1707   var that = {
1708     callbacks: callbacks || {},
1709 
1710     doCallback: function(callback, results) {
1711       if (callback) {
1712         callback(results);
1713       }
1714     },
1715 
1716     reportRunnerResults: function(runner) {
1717       that.doCallback(that.callbacks.runnerCallback, runner);
1718     },
1719     reportSuiteResults:  function(suite) {
1720       that.doCallback(that.callbacks.suiteCallback, suite);
1721     },
1722     reportSpecResults:   function(spec) {
1723       that.doCallback(that.callbacks.specCallback, spec);
1724     },
1725     log: function (str) {
1726       if (console && console.log) console.log(str);
1727     }
1728   };
1729 
1730   return that;
1731 };
1732 
1733 /**
1734  * Runner
1735  *
1736  * @constructor
1737  * @param {jasmine.Env} env
1738  */
1739 jasmine.Runner = function(env) {
1740   var self = this;
1741   self.env = env;
1742   self.queue = new jasmine.Queue(env);
1743   self.before_ = [];
1744   self.after_ = [];
1745   self.suites_ = [];
1746 };
1747 
1748 jasmine.Runner.prototype.execute = function() {
1749   var self = this;
1750   if (self.env.reporter.reportRunnerStarting) {
1751     self.env.reporter.reportRunnerStarting(this);
1752   }
1753   self.queue.start(function () {
1754     self.finishCallback();
1755   });
1756 };
1757 
1758 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
1759   beforeEachFunction.typeName = 'beforeEach';
1760   this.before_.push(beforeEachFunction);
1761 };
1762 
1763 jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
1764   afterEachFunction.typeName = 'afterEach';
1765   this.after_.push(afterEachFunction);
1766 };
1767 
1768 
1769 jasmine.Runner.prototype.finishCallback = function() {
1770   this.env.reporter.reportRunnerResults(this);
1771 };
1772 
1773 jasmine.Runner.prototype.addSuite = function(suite) {
1774   this.suites_.push(suite);
1775 };
1776 
1777 jasmine.Runner.prototype.add = function(block) {
1778   if (block instanceof jasmine.Suite) {
1779     this.addSuite(block);
1780   }
1781   this.queue.add(block);
1782 };
1783 
1784 jasmine.Runner.prototype.specs = function () {
1785   var suites = this.suites();
1786   var specs = [];
1787   for (var i = 0; i < suites.length; i++) {
1788     specs = specs.concat(suites[i].specs());
1789   }
1790   return specs;
1791 };
1792 
1793 
1794 jasmine.Runner.prototype.suites = function() {
1795   return this.suites_;
1796 };
1797 
1798 jasmine.Runner.prototype.results = function() {
1799   return this.queue.results();
1800 };
1801 /**
1802  * Internal representation of a Jasmine specification, or test.
1803  *
1804  * @constructor
1805  * @param {jasmine.Env} env
1806  * @param {jasmine.Suite} suite
1807  * @param {String} description
1808  */
1809 jasmine.Spec = function(env, suite, description) {
1810   if (!env) {
1811     throw new Error('jasmine.Env() required');
1812   }
1813   ;
1814   if (!suite) {
1815     throw new Error('jasmine.Suite() required');
1816   }
1817   ;
1818   var spec = this;
1819   spec.id = env.nextSpecId ? env.nextSpecId() : null;
1820   spec.env = env;
1821   spec.suite = suite;
1822   spec.description = description;
1823   spec.queue = new jasmine.Queue(env);
1824 
1825   spec.afterCallbacks = [];
1826   spec.spies_ = [];
1827 
1828   spec.results_ = new jasmine.NestedResults();
1829   spec.results_.description = description;
1830   spec.matchersClass = null;
1831 };
1832 
1833 jasmine.Spec.prototype.getFullName = function() {
1834   return this.suite.getFullName() + ' ' + this.description + '.';
1835 };
1836 
1837 
1838 jasmine.Spec.prototype.results = function() {
1839   return this.results_;
1840 };
1841 
1842 jasmine.Spec.prototype.log = function(message) {
1843   return this.results_.log(message);
1844 };
1845 
1846 jasmine.Spec.prototype.runs = function (func) {
1847   var block = new jasmine.Block(this.env, func, this);
1848   this.addToQueue(block);
1849   return this;
1850 };
1851 
1852 jasmine.Spec.prototype.addToQueue = function (block) {
1853   if (this.queue.isRunning()) {
1854     this.queue.insertNext(block);
1855   } else {
1856     this.queue.add(block);
1857   }
1858 };
1859 
1860 jasmine.Spec.prototype.addMatcherResult = function(result) {
1861   this.results_.addResult(result);
1862 };
1863 
1864 jasmine.Spec.prototype.expect = function(actual) {
1865   return new (this.getMatchersClass_())(this.env, actual, this);
1866 };
1867 
1868 jasmine.Spec.prototype.waits = function(timeout) {
1869   var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
1870   this.addToQueue(waitsFunc);
1871   return this;
1872 };
1873 
1874 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
1875   var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
1876   this.addToQueue(waitsForFunc);
1877   return this;
1878 };
1879 
1880 jasmine.Spec.prototype.fail = function (e) {
1881   var expectationResult = new jasmine.ExpectationResult({
1882     passed: false,
1883     message: e ? jasmine.util.formatException(e) : 'Exception'
1884   });
1885   this.results_.addResult(expectationResult);
1886 };
1887 
1888 jasmine.Spec.prototype.getMatchersClass_ = function() {
1889   return this.matchersClass || jasmine.Matchers;
1890 };
1891 
1892 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
1893   var parent = this.getMatchersClass_();
1894   var newMatchersClass = function() {
1895     parent.apply(this, arguments);
1896   };
1897   jasmine.util.inherit(newMatchersClass, parent);
1898   for (var method in matchersPrototype) {
1899     newMatchersClass.prototype[method] = matchersPrototype[method];
1900   }
1901   this.matchersClass = newMatchersClass;
1902 };
1903 
1904 jasmine.Spec.prototype.finishCallback = function() {
1905   this.env.reporter.reportSpecResults(this);
1906 };
1907 
1908 jasmine.Spec.prototype.finish = function(onComplete) {
1909   this.removeAllSpies();
1910   this.finishCallback();
1911   if (onComplete) {
1912     onComplete();
1913   }
1914 };
1915 
1916 jasmine.Spec.prototype.after = function(doAfter, test) {
1917 
1918   if (this.queue.isRunning()) {
1919     this.queue.add(new jasmine.Block(this.env, doAfter, this));
1920   } else {
1921     this.afterCallbacks.unshift(doAfter);
1922   }
1923 };
1924 
1925 jasmine.Spec.prototype.execute = function(onComplete) {
1926   var spec = this;
1927   if (!spec.env.specFilter(spec)) {
1928     spec.results_.skipped = true;
1929     spec.finish(onComplete);
1930     return;
1931   }
1932   this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
1933 
1934   spec.env.currentSpec = spec;
1935 
1936   spec.addBeforesAndAftersToQueue();
1937 
1938   spec.queue.start(function () {
1939     spec.finish(onComplete);
1940   });
1941 };
1942 
1943 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
1944   var runner = this.env.currentRunner();
1945   for (var suite = this.suite; suite; suite = suite.parentSuite) {
1946     for (var i = 0; i < suite.before_.length; i++) {
1947       this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
1948     }
1949   }
1950   for (var i = 0; i < runner.before_.length; i++) {
1951     this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
1952   }
1953   for (i = 0; i < this.afterCallbacks.length; i++) {
1954     this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
1955   }
1956   for (suite = this.suite; suite; suite = suite.parentSuite) {
1957     for (var i = 0; i < suite.after_.length; i++) {
1958       this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
1959     }
1960   }
1961   for (var i = 0; i < runner.after_.length; i++) {
1962     this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
1963   }
1964 };
1965 
1966 jasmine.Spec.prototype.explodes = function() {
1967   throw 'explodes function should not have been called';
1968 };
1969 
1970 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
1971   if (obj == undefined) {
1972     throw "spyOn could not find an object to spy upon for " + methodName + "()";
1973   }
1974 
1975   if (!ignoreMethodDoesntExist && obj[methodName] === undefined) {
1976     throw methodName + '() method does not exist';
1977   }
1978 
1979   if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
1980     throw new Error(methodName + ' has already been spied upon');
1981   }
1982 
1983   var spyObj = jasmine.createSpy(methodName);
1984 
1985   this.spies_.push(spyObj);
1986   spyObj.baseObj = obj;
1987   spyObj.methodName = methodName;
1988   spyObj.originalValue = obj[methodName];
1989 
1990   obj[methodName] = spyObj;
1991 
1992   return spyObj;
1993 };
1994 
1995 jasmine.Spec.prototype.removeAllSpies = function() {
1996   for (var i = 0; i < this.spies_.length; i++) {
1997     var spy = this.spies_[i];
1998     spy.baseObj[spy.methodName] = spy.originalValue;
1999   }
2000   this.spies_ = [];
2001 };
2002 
2003 /**
2004  * Internal representation of a Jasmine suite.
2005  *
2006  * @constructor
2007  * @param {jasmine.Env} env
2008  * @param {String} description
2009  * @param {Function} specDefinitions
2010  * @param {jasmine.Suite} parentSuite
2011  */
2012 jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
2013   var self = this;
2014   self.id = env.nextSuiteId ? env.nextSuiteId() : null;
2015   self.description = description;
2016   self.queue = new jasmine.Queue(env);
2017   self.parentSuite = parentSuite;
2018   self.env = env;
2019   self.before_ = [];
2020   self.after_ = [];
2021   self.specs_ = [];
2022 };
2023 
2024 jasmine.Suite.prototype.getFullName = function() {
2025   var fullName = this.description;
2026   for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
2027     fullName = parentSuite.description + ' ' + fullName;
2028   }
2029   return fullName;
2030 };
2031 
2032 jasmine.Suite.prototype.finish = function(onComplete) {
2033   this.env.reporter.reportSuiteResults(this);
2034   this.finished = true;
2035   if (typeof(onComplete) == 'function') {
2036     onComplete();
2037   }
2038 };
2039 
2040 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
2041   beforeEachFunction.typeName = 'beforeEach';
2042   this.before_.push(beforeEachFunction);
2043 };
2044 
2045 jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
2046   afterEachFunction.typeName = 'afterEach';
2047   this.after_.push(afterEachFunction);
2048 };
2049 
2050 jasmine.Suite.prototype.results = function() {
2051   return this.queue.results();
2052 };
2053 
2054 jasmine.Suite.prototype.add = function(block) {
2055   if (block instanceof jasmine.Suite) {
2056     this.env.currentRunner().addSuite(block);
2057   } else {
2058     this.specs_.push(block);
2059   }
2060   this.queue.add(block);
2061 };
2062 
2063 jasmine.Suite.prototype.specs = function() {
2064   return this.specs_;
2065 };
2066 
2067 jasmine.Suite.prototype.execute = function(onComplete) {
2068   var self = this;
2069   this.queue.start(function () {
2070     self.finish(onComplete);
2071   });
2072 };
2073 jasmine.WaitsBlock = function(env, timeout, spec) {
2074   this.timeout = timeout;
2075   jasmine.Block.call(this, env, null, spec);
2076 };
2077 
2078 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
2079 
2080 jasmine.WaitsBlock.prototype.execute = function (onComplete) {
2081   this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
2082   this.env.setTimeout(function () {
2083     onComplete();
2084   }, this.timeout);
2085 };
2086 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
2087   this.timeout = timeout;
2088   this.latchFunction = latchFunction;
2089   this.message = message;
2090   this.totalTimeSpentWaitingForLatch = 0;
2091   jasmine.Block.call(this, env, null, spec);
2092 };
2093 
2094 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
2095 
2096 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100;
2097 
2098 jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
2099   var self = this;
2100   self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen'));
2101   var latchFunctionResult;
2102   try {
2103     latchFunctionResult = self.latchFunction.apply(self.spec);
2104   } catch (e) {
2105     self.spec.fail(e);
2106     onComplete();
2107     return;
2108   }
2109 
2110   if (latchFunctionResult) {
2111     onComplete();
2112   } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) {
2113     var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen');
2114     self.spec.fail({
2115       name: 'timeout',
2116       message: message
2117     });
2118     self.spec._next();
2119   } else {
2120     self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
2121     self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
2122   }
2123 };
2124 // Mock setTimeout, clearTimeout
2125 // Contributed by Pivotal Computer Systems, www.pivotalsf.com
2126 
2127 jasmine.FakeTimer = function() {
2128   this.reset();
2129 
2130   var self = this;
2131   self.setTimeout = function(funcToCall, millis) {
2132     self.timeoutsMade++;
2133     self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
2134     return self.timeoutsMade;
2135   };
2136 
2137   self.setInterval = function(funcToCall, millis) {
2138     self.timeoutsMade++;
2139     self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
2140     return self.timeoutsMade;
2141   };
2142 
2143   self.clearTimeout = function(timeoutKey) {
2144     self.scheduledFunctions[timeoutKey] = undefined;
2145   };
2146 
2147   self.clearInterval = function(timeoutKey) {
2148     self.scheduledFunctions[timeoutKey] = undefined;
2149   };
2150 
2151 };
2152 
2153 jasmine.FakeTimer.prototype.reset = function() {
2154   this.timeoutsMade = 0;
2155   this.scheduledFunctions = {};
2156   this.nowMillis = 0;
2157 };
2158 
2159 jasmine.FakeTimer.prototype.tick = function(millis) {
2160   var oldMillis = this.nowMillis;
2161   var newMillis = oldMillis + millis;
2162   this.runFunctionsWithinRange(oldMillis, newMillis);
2163   this.nowMillis = newMillis;
2164 };
2165 
2166 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
2167   var scheduledFunc;
2168   var funcsToRun = [];
2169   for (var timeoutKey in this.scheduledFunctions) {
2170     scheduledFunc = this.scheduledFunctions[timeoutKey];
2171     if (scheduledFunc != undefined &&
2172         scheduledFunc.runAtMillis >= oldMillis &&
2173         scheduledFunc.runAtMillis <= nowMillis) {
2174       funcsToRun.push(scheduledFunc);
2175       this.scheduledFunctions[timeoutKey] = undefined;
2176     }
2177   }
2178 
2179   if (funcsToRun.length > 0) {
2180     funcsToRun.sort(function(a, b) {
2181       return a.runAtMillis - b.runAtMillis;
2182     });
2183     for (var i = 0; i < funcsToRun.length; ++i) {
2184       try {
2185         var funcToRun = funcsToRun[i];
2186         this.nowMillis = funcToRun.runAtMillis;
2187         funcToRun.funcToCall();
2188         if (funcToRun.recurring) {
2189           this.scheduleFunction(funcToRun.timeoutKey,
2190             funcToRun.funcToCall,
2191             funcToRun.millis,
2192             true);
2193         }
2194       } catch(e) {
2195       }
2196     }
2197     this.runFunctionsWithinRange(oldMillis, nowMillis);
2198   }
2199 };
2200 
2201 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
2202   this.scheduledFunctions[timeoutKey] = {
2203     runAtMillis: this.nowMillis + millis,
2204     funcToCall: funcToCall,
2205     recurring: recurring,
2206     timeoutKey: timeoutKey,
2207     millis: millis
2208   };
2209 };
2210 
2211 
2212 jasmine.Clock = {
2213   defaultFakeTimer: new jasmine.FakeTimer(),
2214 
2215   reset: function() {
2216     jasmine.Clock.assertInstalled();
2217     jasmine.Clock.defaultFakeTimer.reset();
2218   },
2219 
2220   tick: function(millis) {
2221     jasmine.Clock.assertInstalled();
2222     jasmine.Clock.defaultFakeTimer.tick(millis);
2223   },
2224 
2225   runFunctionsWithinRange: function(oldMillis, nowMillis) {
2226     jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
2227   },
2228 
2229   scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
2230     jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
2231   },
2232 
2233   useMock: function() {
2234     var spec = jasmine.getEnv().currentSpec;
2235     spec.after(jasmine.Clock.uninstallMock);
2236 
2237     jasmine.Clock.installMock();
2238   },
2239 
2240   installMock: function() {
2241     jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
2242   },
2243 
2244   uninstallMock: function() {
2245     jasmine.Clock.assertInstalled();
2246     jasmine.Clock.installed = jasmine.Clock.real;
2247   },
2248 
2249   real: {
2250     setTimeout: window.setTimeout,
2251     clearTimeout: window.clearTimeout,
2252     setInterval: window.setInterval,
2253     clearInterval: window.clearInterval
2254   },
2255 
2256   assertInstalled: function() {
2257     if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
2258       throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
2259     }
2260   },
2261 
2262   installed: null
2263 };
2264 jasmine.Clock.installed = jasmine.Clock.real;
2265 
2266 //else for IE support
2267 window.setTimeout = function(funcToCall, millis) {
2268   if (jasmine.Clock.installed.setTimeout.apply) {
2269     return jasmine.Clock.installed.setTimeout.apply(this, arguments);
2270   } else {
2271     return jasmine.Clock.installed.setTimeout(funcToCall, millis);
2272   }
2273 };
2274 
2275 window.setInterval = function(funcToCall, millis) {
2276   if (jasmine.Clock.installed.setInterval.apply) {
2277     return jasmine.Clock.installed.setInterval.apply(this, arguments);
2278   } else {
2279     return jasmine.Clock.installed.setInterval(funcToCall, millis);
2280   }
2281 };
2282 
2283 window.clearTimeout = function(timeoutKey) {
2284   if (jasmine.Clock.installed.clearTimeout.apply) {
2285     return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
2286   } else {
2287     return jasmine.Clock.installed.clearTimeout(timeoutKey);
2288   }
2289 };
2290 
2291 window.clearInterval = function(timeoutKey) {
2292   if (jasmine.Clock.installed.clearTimeout.apply) {
2293     return jasmine.Clock.installed.clearInterval.apply(this, arguments);
2294   } else {
2295   return jasmine.Clock.installed.clearInterval(timeoutKey);
2296   }
2297 };
2298 
2299