From 5ae63fd385295d5a7bbdc79466f59727dcab1c85 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 17 Jan 2013 16:53:30 -0800 Subject: fix(angular.equals): consistently compare undefined object props previously: a = {}; b = {x:undefined}; angular.equals(a, b) == angular.equals(b, a) // returns false. both should return false because these objects are not equal. unlike in implemented in #1695 the comparison should be stricter and return false not true. if we need to relax this in the future we can always do so. Closes #1648 --- test/AngularSpec.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/AngularSpec.js') diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 47670296..f5638b9c 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -126,6 +126,14 @@ describe('angular', function() { expect(equals(['misko'], ['misko', 'adam'])).toEqual(false); }); + it('should ignore undefined member variables', function() { + var obj1 = {name: 'misko'}, + obj2 = {name: 'misko', undefinedvar: undefined}; + + expect(equals(obj1, obj2)).toBe(false); + expect(equals(obj2, obj1)).toBe(false); + }); + it('should ignore $ member variables', function() { expect(equals({name:'misko', $id:1}, {name:'misko', $id:2})).toEqual(true); expect(equals({name:'misko'}, {name:'misko', $id:2})).toEqual(true); -- cgit v1.2.3