allow undefined as function
This commit is contained in:
committed by
Gregg Van Hove
parent
0c7f36a181
commit
d2b33e0c66
@@ -82,8 +82,8 @@ describe("Env", function() {
|
|||||||
describe('#it', function () {
|
describe('#it', function () {
|
||||||
it('throws an error when it receives a non-fn argument', function() {
|
it('throws an error when it receives a non-fn argument', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
env.it('undefined arg', undefined);
|
env.it('undefined arg', null);
|
||||||
}).toThrowError(/it expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
}).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not throw when it is not given a fn argument', function() {
|
it('does not throw when it is not given a fn argument', function() {
|
||||||
@@ -105,8 +105,8 @@ describe("Env", function() {
|
|||||||
|
|
||||||
it('throws an error when it receives a non-fn argument', function() {
|
it('throws an error when it receives a non-fn argument', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
env.xit('undefined arg', undefined);
|
env.xit('undefined arg', null);
|
||||||
}).toThrowError(/xit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
}).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not throw when it is not given a fn argument', function() {
|
it('does not throw when it is not given a fn argument', function() {
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
// it() sometimes doesn't have a fn argument, so only check the type if
|
// it() sometimes doesn't have a fn argument, so only check the type if
|
||||||
// it's given.
|
// it's given.
|
||||||
if (arguments.length > 1) {
|
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||||
ensureIsFunction(fn, 'it');
|
ensureIsFunction(fn, 'it');
|
||||||
}
|
}
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
@@ -466,7 +466,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.xit = function(description, fn, timeout) {
|
this.xit = function(description, fn, timeout) {
|
||||||
// xit(), like it(), doesn't always have a fn argument, so only check the
|
// xit(), like it(), doesn't always have a fn argument, so only check the
|
||||||
// type when needed.
|
// type when needed.
|
||||||
if (arguments.length > 1) {
|
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||||
ensureIsFunction(fn, 'xit');
|
ensureIsFunction(fn, 'xit');
|
||||||
}
|
}
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = this.it.apply(this, arguments);
|
||||||
|
|||||||
Reference in New Issue
Block a user