diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 95b98208..b431d9ff 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1786,6 +1786,7 @@ getJasmineRequireObj().Suite = function() { Suite.prototype.disable = function() { this.disabled = true; + this.result.status = 'disabled'; }; Suite.prototype.beforeEach = function(fn) { @@ -1802,6 +1803,9 @@ getJasmineRequireObj().Suite = function() { Suite.prototype.execute = function(onComplete) { var self = this; + + this.onStart(this); + if (this.disabled) { complete(); return; @@ -1813,8 +1817,6 @@ getJasmineRequireObj().Suite = function() { allFns.push(wrapChildAsAsync(this.children[i])); } - this.onStart(this); - this.queueRunner({ fns: allFns, onComplete: complete diff --git a/spec/core/SuiteSpec.js b/spec/core/SuiteSpec.js index a51b4ca1..c29d2f4a 100644 --- a/spec/core/SuiteSpec.js +++ b/spec/core/SuiteSpec.js @@ -67,12 +67,17 @@ describe("Suite", function() { expect(suite.afterFns).toEqual([innerAfter, outerAfter]); }); - it("can be disabled", function() { + it("can be disabled, but still calls callbacks", function() { var env = new j$.Env(), fakeQueueRunner = jasmine.createSpy('fake queue runner'), + onStart = jasmine.createSpy('onStart'), + resultCallback = jasmine.createSpy('resultCallback'), + onComplete = jasmine.createSpy('onComplete'), suite = new j$.Suite({ env: env, description: "with a child suite", + onStart: onStart, + resultCallback: resultCallback, queueRunner: fakeQueueRunner }); @@ -80,9 +85,12 @@ describe("Suite", function() { expect(suite.disabled).toBe(true); - suite.execute(); + suite.execute(onComplete); expect(fakeQueueRunner).not.toHaveBeenCalled(); + expect(onStart).toHaveBeenCalled(); + expect(resultCallback).toHaveBeenCalled(); + expect(onComplete).toHaveBeenCalled(); }); it("delegates execution of its specs and suites", function() { diff --git a/src/core/Suite.js b/src/core/Suite.js index 8c67d6ce..4d5e3935 100644 --- a/src/core/Suite.js +++ b/src/core/Suite.js @@ -52,6 +52,9 @@ getJasmineRequireObj().Suite = function() { Suite.prototype.execute = function(onComplete) { var self = this; + + this.onStart(this); + if (this.disabled) { complete(); return; @@ -63,8 +66,6 @@ getJasmineRequireObj().Suite = function() { allFns.push(wrapChildAsAsync(this.children[i])); } - this.onStart(this); - this.queueRunner({ fns: allFns, onComplete: complete