@@ -320,14 +320,14 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Spec.prototype.addExpectationResult = function(passed, data) {
|
Spec.prototype.addExpectationResult = function(passed, data, isError) {
|
||||||
var expectationResult = this.expectationResultFactory(data);
|
var expectationResult = this.expectationResultFactory(data);
|
||||||
if (passed) {
|
if (passed) {
|
||||||
this.result.passedExpectations.push(expectationResult);
|
this.result.passedExpectations.push(expectationResult);
|
||||||
} else {
|
} else {
|
||||||
this.result.failedExpectations.push(expectationResult);
|
this.result.failedExpectations.push(expectationResult);
|
||||||
|
|
||||||
if(this.throwOnExpectationFailure){
|
if (this.throwOnExpectationFailure && !isError) {
|
||||||
throw new j$.errors.ExpectationFailed();
|
throw new j$.errors.ExpectationFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
expected: '',
|
expected: '',
|
||||||
actual: '',
|
actual: '',
|
||||||
error: e
|
error: e
|
||||||
});
|
}, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.disable = function() {
|
Spec.prototype.disable = function() {
|
||||||
|
|||||||
@@ -276,6 +276,19 @@ describe("Spec", function() {
|
|||||||
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['failed']);
|
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['failed']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not throw an ExpectationFailed error when handling an error", function() {
|
||||||
|
var resultCallback = jasmine.createSpy('resultCallback'),
|
||||||
|
spec = new j$.Spec({
|
||||||
|
queueableFn: { fn: function() {} },
|
||||||
|
expectationResultFactory: function(data) { return data; },
|
||||||
|
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
||||||
|
resultCallback: resultCallback,
|
||||||
|
throwOnExpectationFailure: true
|
||||||
|
});
|
||||||
|
|
||||||
|
spec.onException('failing exception');
|
||||||
|
});
|
||||||
|
|
||||||
it("can return its full name", function() {
|
it("can return its full name", function() {
|
||||||
var specNameSpy = jasmine.createSpy('specNameSpy').and.returnValue('expected val');
|
var specNameSpy = jasmine.createSpy('specNameSpy').and.returnValue('expected val');
|
||||||
|
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Spec.prototype.addExpectationResult = function(passed, data) {
|
Spec.prototype.addExpectationResult = function(passed, data, isError) {
|
||||||
var expectationResult = this.expectationResultFactory(data);
|
var expectationResult = this.expectationResultFactory(data);
|
||||||
if (passed) {
|
if (passed) {
|
||||||
this.result.passedExpectations.push(expectationResult);
|
this.result.passedExpectations.push(expectationResult);
|
||||||
} else {
|
} else {
|
||||||
this.result.failedExpectations.push(expectationResult);
|
this.result.failedExpectations.push(expectationResult);
|
||||||
|
|
||||||
if(this.throwOnExpectationFailure){
|
if (this.throwOnExpectationFailure && !isError) {
|
||||||
throw new j$.errors.ExpectationFailed();
|
throw new j$.errors.ExpectationFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
expected: '',
|
expected: '',
|
||||||
actual: '',
|
actual: '',
|
||||||
error: e
|
error: e
|
||||||
});
|
}, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.disable = function() {
|
Spec.prototype.disable = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user