From 1dcafd18afed4465ee13db91cedc8fecc3aa2c96 Mon Sep 17 00:00:00 2001 From: Brenton Date: Sat, 1 Jun 2013 23:29:18 -0700 Subject: fix(equals): {} and [] should not be considered equivalent angular.equals was returning inconsistent values for the comparison between {} and []: angular.equals({}, []) // true angular.equals([], {}]) // false Since these object are not of the same type, they should not be considered equivalent. --- test/AngularSpec.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/AngularSpec.js') diff --git a/test/AngularSpec.js b/test/AngularSpec.js index b43edf1c..a58b8109 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -289,6 +289,11 @@ describe('angular', function() { expect(equals(/^abc/, /abc/)).toBe(false); expect(equals(/^abc/, '/^abc/')).toBe(false); }); + + it('should return false when comparing an object and an array', function() { + expect(equals({}, [])).toBe(false); + expect(equals([], {})).toBe(false); + }); }); describe('size', function() { -- cgit v1.2.3