Merge branch 'suite-start' of https://github.com/javenwang/jasmine into javenwang-suite-start
This commit is contained in:
@@ -1786,6 +1786,7 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
|
|
||||||
Suite.prototype.disable = function() {
|
Suite.prototype.disable = function() {
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
|
this.result.status = 'disabled';
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.beforeEach = function(fn) {
|
Suite.prototype.beforeEach = function(fn) {
|
||||||
@@ -1802,6 +1803,9 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
|
|
||||||
Suite.prototype.execute = function(onComplete) {
|
Suite.prototype.execute = function(onComplete) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
this.onStart(this);
|
||||||
|
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
complete();
|
complete();
|
||||||
return;
|
return;
|
||||||
@@ -1813,8 +1817,6 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
allFns.push(wrapChildAsAsync(this.children[i]));
|
allFns.push(wrapChildAsAsync(this.children[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onStart(this);
|
|
||||||
|
|
||||||
this.queueRunner({
|
this.queueRunner({
|
||||||
fns: allFns,
|
fns: allFns,
|
||||||
onComplete: complete
|
onComplete: complete
|
||||||
|
|||||||
@@ -67,12 +67,17 @@ describe("Suite", function() {
|
|||||||
expect(suite.afterFns).toEqual([innerAfter, outerAfter]);
|
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(),
|
var env = new j$.Env(),
|
||||||
fakeQueueRunner = jasmine.createSpy('fake queue runner'),
|
fakeQueueRunner = jasmine.createSpy('fake queue runner'),
|
||||||
|
onStart = jasmine.createSpy('onStart'),
|
||||||
|
resultCallback = jasmine.createSpy('resultCallback'),
|
||||||
|
onComplete = jasmine.createSpy('onComplete'),
|
||||||
suite = new j$.Suite({
|
suite = new j$.Suite({
|
||||||
env: env,
|
env: env,
|
||||||
description: "with a child suite",
|
description: "with a child suite",
|
||||||
|
onStart: onStart,
|
||||||
|
resultCallback: resultCallback,
|
||||||
queueRunner: fakeQueueRunner
|
queueRunner: fakeQueueRunner
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -80,9 +85,12 @@ describe("Suite", function() {
|
|||||||
|
|
||||||
expect(suite.disabled).toBe(true);
|
expect(suite.disabled).toBe(true);
|
||||||
|
|
||||||
suite.execute();
|
suite.execute(onComplete);
|
||||||
|
|
||||||
expect(fakeQueueRunner).not.toHaveBeenCalled();
|
expect(fakeQueueRunner).not.toHaveBeenCalled();
|
||||||
|
expect(onStart).toHaveBeenCalled();
|
||||||
|
expect(resultCallback).toHaveBeenCalled();
|
||||||
|
expect(onComplete).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("delegates execution of its specs and suites", function() {
|
it("delegates execution of its specs and suites", function() {
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
|
|
||||||
Suite.prototype.execute = function(onComplete) {
|
Suite.prototype.execute = function(onComplete) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
this.onStart(this);
|
||||||
|
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
complete();
|
complete();
|
||||||
return;
|
return;
|
||||||
@@ -63,8 +66,6 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
allFns.push(wrapChildAsAsync(this.children[i]));
|
allFns.push(wrapChildAsAsync(this.children[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onStart(this);
|
|
||||||
|
|
||||||
this.queueRunner({
|
this.queueRunner({
|
||||||
fns: allFns,
|
fns: allFns,
|
||||||
onComplete: complete
|
onComplete: complete
|
||||||
|
|||||||
Reference in New Issue
Block a user