expect(null).toEqual(jasmine.any(Object)) no longer passes
[Finishes #153181443] Fixes #1255.
This commit is contained in:
@@ -1589,7 +1589,7 @@ getJasmineRequireObj().Any = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.expectedObject == Object) {
|
if (this.expectedObject == Object) {
|
||||||
return typeof other == 'object';
|
return other !== null && typeof other == 'object';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.expectedObject == Boolean) {
|
if (this.expectedObject == Boolean) {
|
||||||
|
|||||||
@@ -68,10 +68,17 @@ describe("Any", function() {
|
|||||||
expect(any.asymmetricMatch(new Thing())).toBe(true);
|
expect(any.asymmetricMatch(new Thing())).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not treat null as an Object", function() {
|
||||||
|
var any = new jasmineUnderTest.Any(Object);
|
||||||
|
|
||||||
|
expect(any.asymmetricMatch(null)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it("jasmineToString's itself", function() {
|
it("jasmineToString's itself", function() {
|
||||||
var any = new jasmineUnderTest.Any(Number);
|
var any = new jasmineUnderTest.Any(Number);
|
||||||
|
|
||||||
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
||||||
|
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when called without an argument", function() {
|
describe("when called without an argument", function() {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ getJasmineRequireObj().Any = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.expectedObject == Object) {
|
if (this.expectedObject == Object) {
|
||||||
return typeof other == 'object';
|
return other !== null && typeof other == 'object';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.expectedObject == Boolean) {
|
if (this.expectedObject == Boolean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user