Fix ordering for suites with more than 11 direct children.

- When no specs were focused, they all had the same precedence, and
  `sort`ing them caused some of the nodes to move around

Fixes #850
This commit is contained in:
Gregg Van Hove
2015-05-13 14:45:11 -07:00
parent 7cbd86357d
commit 65a6decd6d
3 changed files with 80 additions and 24 deletions

View File

@@ -132,30 +132,29 @@ getJasmineRequireObj().TreeProcessor = function() {
}
function orderChildSegments(children) {
var result = [];
var specifiedOrder = [],
unspecifiedOrder = [];
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++) {
result.push(segments[j]);
var seg = segments[j];
if (seg.min === defaultMin) {
unspecifiedOrder.push(seg);
} else {
specifiedOrder.push(seg);
}
}
}
result.sort(function(a, b) {
if (a.min === null) {
return b.min === null ? 0 : 1;
}
if (b.min === null) {
return -1;
}
specifiedOrder.sort(function(a, b) {
return a.min - b.min;
});
return result;
return specifiedOrder.concat(unspecifiedOrder);
}
function executeNode(node, segmentNumber) {