Merge branch 'UziTech-ensure-function-or-undefined'

- Merges #1329 from @UziTech
- Fixes #1328
This commit is contained in:
Gregg Van Hove
2017-04-26 13:49:31 -07:00
2 changed files with 6 additions and 6 deletions

View File

@@ -82,8 +82,8 @@ describe("Env", function() {
describe('#it', function () {
it('throws an error when it receives a non-fn argument', function() {
expect(function() {
env.it('undefined arg', undefined);
}).toThrowError(/it expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
env.it('undefined arg', null);
}).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
});
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() {
expect(function() {
env.xit('undefined arg', undefined);
}).toThrowError(/xit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
env.xit('undefined arg', null);
}).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
});
it('does not throw when it is not given a fn argument', function() {

View File

@@ -452,7 +452,7 @@ getJasmineRequireObj().Env = function(j$) {
this.it = function(description, fn, timeout) {
// it() sometimes doesn't have a fn argument, so only check the type if
// it's given.
if (arguments.length > 1) {
if (arguments.length > 1 && typeof fn !== 'undefined') {
ensureIsFunction(fn, 'it');
}
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
@@ -466,7 +466,7 @@ getJasmineRequireObj().Env = function(j$) {
this.xit = function(description, fn, timeout) {
// xit(), like it(), doesn't always have a fn argument, so only check the
// type when needed.
if (arguments.length > 1) {
if (arguments.length > 1 && typeof fn !== 'undefined') {
ensureIsFunction(fn, 'xit');
}
var spec = this.it.apply(this, arguments);