mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-18 12:08:17 +08:00
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.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user