From 1c6f4ef0e69cd6cf8a8620e8acd336b880c494d8 Mon Sep 17 00:00:00 2001 From: Gregg Van Hove and Molly Trombley-McCann Date: Wed, 4 Mar 2015 11:58:47 -0800 Subject: [PATCH] Build distribution for previous changes --- lib/jasmine-core/jasmine.js | 45 ++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index ab0c4966..219cb5bc 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -333,14 +333,11 @@ getJasmineRequireObj().Spec = function(j$) { Spec.prototype.execute = function(onComplete, enabled) { var self = this; - if (enabled === false && !this.markedPending) { - this.disable(); - } this.onStart(this); - if (!this.isExecutable()) { - complete(); + if (!this.isExecutable() || enabled === false) { + complete(enabled); return; } @@ -354,8 +351,8 @@ getJasmineRequireObj().Spec = function(j$) { userContext: this.userContext() }); - function complete() { - self.result.status = self.status(); + function complete(enabledAgain) { + self.result.status = self.status(enabledAgain); self.resultCallback(self.result); if (onComplete) { @@ -395,8 +392,8 @@ getJasmineRequireObj().Spec = function(j$) { return this.result; }; - Spec.prototype.status = function() { - if (this.disabled) { + Spec.prototype.status = function(enabled) { + if (this.disabled || enabled === false) { return 'disabled'; } @@ -2217,7 +2214,7 @@ getJasmineRequireObj().TreeProcessor = function() { } stats[node.id] = { - executable: hasExecutableChild, + executable: hasExecutableChild }; segmentChildren(node, stats[node.id], executableIndex); @@ -2242,13 +2239,17 @@ getJasmineRequireObj().TreeProcessor = function() { lastMax = defaultMax, orderedChildSegments = orderChildSegments(node.children); + function isSegmentBoundary(minIndex) { + return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1; + } + for (var i = 0; i < orderedChildSegments.length; i++) { var childSegment = orderedChildSegments[i], - maxIndex = childSegment.max, - minIndex = childSegment.min; + maxIndex = childSegment.max, + minIndex = childSegment.min; - if (lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1) { - currentSegment = { index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMin }; + if (isSegmentBoundary(minIndex)) { + currentSegment = {index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMax}; result.push(currentSegment); } @@ -2261,11 +2262,11 @@ getJasmineRequireObj().TreeProcessor = function() { nodeStats.segments = result; } - function orderChildSegments(array) { + function orderChildSegments(children) { var result = []; - for (var i = 0; i < array.length; i++) { - var child = array[i], + for (var i = 0; i < children.length; i++) { + var child = children[i], segments = stats[child.id].segments; for (var j = 0; j < segments.length; j++) { @@ -2314,14 +2315,6 @@ getJasmineRequireObj().TreeProcessor = function() { } } - function minValue(array) { - return Math.min.apply(null, array); - } - - function maxValue(array) { - return Math.max.apply(null, array); - } - function wrapChildren(node, segmentNumber) { var result = [], segmentChildren = stats[node.id].segments[segmentNumber].nodes; @@ -2372,7 +2365,7 @@ getJasmineRequireObj().Any = function() { }; Any.prototype.jasmineToString = function() { - return ''; + return ''; }; return Any;