Prevents *Alls from running when runnables are explicitly set

- This requires passing if runnables are set to the Suite. Hopefully in
  the future we will change how focused runnables and *Alls interact so
  this is no longer necessary.

[#732]
This commit is contained in:
Greg Cobb
2015-01-23 17:27:13 -08:00
parent 1936a36c79
commit ebbaab4cf9
5 changed files with 82 additions and 18 deletions

View File

@@ -237,6 +237,7 @@ getJasmineRequireObj().Env = function(j$) {
onStart: suiteStarted,
expectationFactory: expectationFactory,
expectationResultFactory: expectationResultFactory,
runnablesExplictlySetGetter: runnablesExplictlySetGetter,
resultCallback: function(attrs) {
if (!suite.disabled) {
clearResourcesForRunnable(suite.id);

View File

@@ -9,6 +9,7 @@ getJasmineRequireObj().Suite = function() {
this.clearStack = attrs.clearStack || function(fn) {fn();};
this.expectationFactory = attrs.expectationFactory;
this.expectationResultFactory = attrs.expectationResultFactory;
this.runnablesExplictlySetGetter = attrs.runnablesExplictlySetGetter || function() {};
this.beforeFns = [];
this.afterFns = [];
@@ -120,14 +121,8 @@ getJasmineRequireObj().Suite = function() {
};
Suite.prototype.isExecutable = function() {
var foundActive = false;
for(var i = 0; i < this.children.length; i++) {
if(this.children[i].isExecutable()) {
foundActive = true;
break;
}
}
return foundActive;
var runnablesExplicitlySet = this.runnablesExplictlySetGetter();
return !runnablesExplicitlySet && hasExecutableChild(this.children);
};
Suite.prototype.sharedUserContext = function() {
@@ -180,6 +175,17 @@ getJasmineRequireObj().Suite = function() {
return !args[0];
}
function hasExecutableChild(children) {
var foundActive = false;
for (var i = 0; i < children.length; i++) {
if (children[i].isExecutable()) {
foundActive = true;
break;
}
}
return foundActive;
}
function clone(obj) {
var clonedObj = {};
for (var prop in obj) {