Changeset View
Changeset View
Standalone View
Standalone View
specs/jasmine/jasmine.js
| Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * @ignore | * @ignore | ||||
| * @private | * @private | ||||
| * @param value | * @param value | ||||
| * @returns {Boolean} | * @returns {Boolean} | ||||
| */ | */ | ||||
| jasmine.isArray_ = function(value) { | jasmine.isArray_ = function(value) { | ||||
| return jasmine.isA_("Array", value); | return jasmine.isA_("Array", value); | ||||
| }; | }; | ||||
| /** | /** | ||||
| * @ignore | * @ignore | ||||
| * @private | * @private | ||||
| * @param value | * @param value | ||||
| * @returns {Boolean} | * @returns {Boolean} | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 830 Lines • ▼ Show 20 Lines | |||||
| * @param {jasmine.Spec} spec | * @param {jasmine.Spec} spec | ||||
| */ | */ | ||||
| jasmine.Block = function(env, func, spec) { | jasmine.Block = function(env, func, spec) { | ||||
| this.env = env; | this.env = env; | ||||
| this.func = func; | this.func = func; | ||||
| this.spec = spec; | this.spec = spec; | ||||
| }; | }; | ||||
| jasmine.Block.prototype.execute = function(onComplete) { | jasmine.Block.prototype.execute = function(onComplete) { | ||||
| try { | try { | ||||
| this.func.apply(this.spec); | this.func.apply(this.spec); | ||||
| } catch (e) { | } catch (e) { | ||||
| this.spec.fail(e); | this.spec.fail(e); | ||||
| } | } | ||||
| onComplete(); | onComplete(); | ||||
| }; | }; | ||||
| /** JavaScript API reporter. | /** JavaScript API reporter. | ||||
| Show All 23 Lines | |||||
| jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { | jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { | ||||
| var isSuite = suiteOrSpec instanceof jasmine.Suite; | var isSuite = suiteOrSpec instanceof jasmine.Suite; | ||||
| var summary = { | var summary = { | ||||
| id: suiteOrSpec.id, | id: suiteOrSpec.id, | ||||
| name: suiteOrSpec.description, | name: suiteOrSpec.description, | ||||
| type: isSuite ? 'suite' : 'spec', | type: isSuite ? 'suite' : 'spec', | ||||
| children: [] | children: [] | ||||
| }; | }; | ||||
| if (isSuite) { | if (isSuite) { | ||||
| var children = suiteOrSpec.children(); | var children = suiteOrSpec.children(); | ||||
| for (var i = 0; i < children.length; i++) { | for (var i = 0; i < children.length; i++) { | ||||
| summary.children.push(this.summarize_(children[i])); | summary.children.push(this.summarize_(children[i])); | ||||
| } | } | ||||
| } | } | ||||
| return summary; | return summary; | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 684 Lines • ▼ Show 20 Lines | |||||
| jasmine.Queue.LOOP_DONT_RECURSE = true; | jasmine.Queue.LOOP_DONT_RECURSE = true; | ||||
| jasmine.Queue.prototype.next_ = function() { | jasmine.Queue.prototype.next_ = function() { | ||||
| var self = this; | var self = this; | ||||
| var goAgain = true; | var goAgain = true; | ||||
| while (goAgain) { | while (goAgain) { | ||||
| goAgain = false; | goAgain = false; | ||||
| if (self.index < self.blocks.length && !this.abort) { | if (self.index < self.blocks.length && !this.abort) { | ||||
| var calledSynchronously = true; | var calledSynchronously = true; | ||||
| var completedSynchronously = false; | var completedSynchronously = false; | ||||
| var onComplete = function () { | var onComplete = function () { | ||||
| if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { | if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { | ||||
| completedSynchronously = true; | completedSynchronously = true; | ||||
| return; | return; | ||||
| Show All 21 Lines | if (self.index < self.blocks.length && !this.abort) { | ||||
| } | } | ||||
| }; | }; | ||||
| self.blocks[self.index].execute(onComplete); | self.blocks[self.index].execute(onComplete); | ||||
| calledSynchronously = false; | calledSynchronously = false; | ||||
| if (completedSynchronously) { | if (completedSynchronously) { | ||||
| onComplete(); | onComplete(); | ||||
| } | } | ||||
| } else { | } else { | ||||
| self.running = false; | self.running = false; | ||||
| if (self.onComplete) { | if (self.onComplete) { | ||||
| self.onComplete(); | self.onComplete(); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 668 Lines • Show Last 20 Lines | |||||