-
Notifications
You must be signed in to change notification settings - Fork 408
fix(test): fix #1069, FakeDate should handle constructor parameter #1070
Conversation
38e6d52
to
8fa6f49
Compare
lib/zone-spec/fake-async-test.ts
Outdated
d.setTime(FakeDate.now()); | ||
return d; | ||
case 1: | ||
return new OriginalDate(arguments[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you try new OriginalDate(...arguments)
That would be nicer than having a big switch statemente.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhevery , yes, this is a better way, I will change it , thank you.
0eaed3f
to
887c8bc
Compare
find another
such as the following sample : describe('', () => {
beforeEach(jasmine.clock().install);
afterEach(jasmine.clock().uninstall);
});
it('user do fakeAsync themselves', fakeAsync(() => {
// 1. user use jasmine.clock()
// 2. and don't use clock patch
// 3. and user use fakeAsync themselves
setTimeout(spy, 100);
expect(spy).not.toHaveBeenCalled();
jasmine.clock().tick(100);
expect(spy).toHaveBeenCalled();
})); This case will So the current behavior of
Conclusion, if other modifications.
|
fix #1069.
fix #1071.
in
fakeAsync
, nowDate
is monkey-patched withFakeDate
,FakeDate
should handle parameters in constructor correctly, such asnew Date(1995, 1)
,new Date(0)
.should handle
Date.UTC()
infakeAsync
correctlyshould handle
Date.parse()
infakeAsync
correctly@mhevery , sorry this is a regression bug, please review and please check should we cut a new release or not.