mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-27 15:04:02 +00:00
bug(equals): incorect comparison of dates
This commit is contained in:
parent
5d8528cc2e
commit
ffa8441886
2 changed files with 9 additions and 0 deletions
|
|
@ -671,6 +671,8 @@ function equals(o1, o2) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (isDate(o1)) {
|
||||||
|
return isDate(o2) && o1.getTime() == o2.getTime();
|
||||||
} else {
|
} else {
|
||||||
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false;
|
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false;
|
||||||
keySet = {};
|
keySet = {};
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,13 @@ describe('angular', function() {
|
||||||
expect(equals(window, window.parent)).toBe(false);
|
expect(equals(window, window.parent)).toBe(false);
|
||||||
expect(equals(window, undefined)).toBe(false);
|
expect(equals(window, undefined)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should compare dates', function() {
|
||||||
|
expect(equals(new Date(0), new Date(0))).toBe(true);
|
||||||
|
expect(equals(new Date(0), new Date(1))).toBe(false);
|
||||||
|
expect(equals(new Date(0), 0)).toBe(false);
|
||||||
|
expect(equals(0, new Date(0))).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('size', function() {
|
describe('size', function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue