From b0be87f663e8684c1369e1bff740c1750ba17080 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 13 Jan 2011 07:55:31 -0800 Subject: fix for angular.Object.equals to handle equals({},null) --- test/AngularSpec.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/AngularSpec.js') diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 62298465..0e6b2bfa 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -89,6 +89,28 @@ describe('equals', function(){ it('should ignore functions', function(){ expect(equals({func: function() {}}, {bar: function() {}})).toEqual(true); }); + + it('should work well with nulls', function() { + expect(equals(null, '123')).toBe(false); + expect(equals('123', null)).toBe(false); + + var obj = {foo:'bar'}; + expect(equals(null, obj)).toBe(false); + expect(equals(obj, null)).toBe(false); + + expect(equals(null, null)).toBe(true); + }); + + it('should work well with undefined', function() { + expect(equals(undefined, '123')).toBe(false); + expect(equals('123', undefined)).toBe(false); + + var obj = {foo:'bar'}; + expect(equals(undefined, obj)).toBe(false); + expect(equals(obj, undefined)).toBe(false); + + expect(equals(undefined, undefined)).toBe(true); + }); }); describe('parseKeyValue', function() { -- cgit v1.2.3