fix(test): fix #1069, FakeDate should handle constructor parameter#1070
fix(test): fix #1069, FakeDate should handle constructor parameter#1070mhevery merged 1 commit intoangular:masterfrom
Conversation
38e6d52 to
8fa6f49
Compare
| d.setTime(FakeDate.now()); | ||
| return d; | ||
| case 1: | ||
| return new OriginalDate(arguments[0]); |
There was a problem hiding this comment.
did you try new OriginalDate(...arguments) That would be nicer than having a big switch statemente.
There was a problem hiding this comment.
@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, nowDateis monkey-patched withFakeDate,FakeDateshould handle parameters in constructor correctly, such asnew Date(1995, 1),new Date(0).should handle
Date.UTC()infakeAsynccorrectlyshould handle
Date.parse()infakeAsynccorrectly@mhevery , sorry this is a regression bug, please review and please check should we cut a new release or not.