diff options
| author | Brenton | 2013-06-01 23:29:18 -0700 | 
|---|---|---|
| committer | Brian Ford | 2013-08-12 16:23:38 -0700 | 
| commit | da1f7c762d36b646c107260f74daf3a0ab5f91f5 (patch) | |
| tree | 1925943897cb2dcf7e64dc9e90b135adbd96108c /test/AngularSpec.js | |
| parent | 89366bdbf918175818cf03d6208ee6fd23db7d00 (diff) | |
| download | angular.js-da1f7c762d36b646c107260f74daf3a0ab5f91f5.tar.bz2 | |
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.
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 5 | 
1 files changed, 5 insertions, 0 deletions
| diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 5da22174..5e7cb410 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -302,6 +302,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() { | 
