From 896ce41c8f1cdf8ec41efa84f9a267253b2b88e6 Mon Sep 17 00:00:00 2001 From: Bala Date: Sat, 27 Apr 2019 12:52:06 +0530 Subject: [PATCH] Hover over date clears time filter fix #3420 --- packages/datetime/src/timePicker.tsx | 18 +----------------- .../datetime/test/dateRangePickerTests.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/packages/datetime/src/timePicker.tsx b/packages/datetime/src/timePicker.tsx index 0cdcbb326d..8b130d3dd9 100644 --- a/packages/datetime/src/timePicker.tsx +++ b/packages/datetime/src/timePicker.tsx @@ -283,23 +283,7 @@ export class TimePicker extends React.Component", () => { assert.isTrue(DateUtils.areSameDay(onChangeSpy.firstCall.args[0][0] as Date, defaultRange[0])); }); + it("hovering over date does not change entered time", () => { + const harness = render({ timePrecision: "minute", defaultValue: defaultRange }); + harness.changeTimeInput("minute", 10, "left"); + const { left } = harness; + left.mouseEnterDay(5); + assert.equal((onChangeSpy.firstCall.args[0][0] as Date).getMinutes(), 10); + }); + it("changing time without date uses today", () => { render({ timePrecision: "minute" }).setTimeInput("minute", 45, "left"); assert.isTrue(DateUtils.areSameDay(onChangeSpy.firstCall.args[0][0] as Date, new Date())); @@ -1215,6 +1223,11 @@ describe("", () => { ); } }, + changeTimeInput: (precision: TimePrecision | "hour", value: number, which: "left" | "right") => + harness.wrapper + .find(`.${DateClasses.TIMEPICKER}-${precision}`) + .at(which === "left" ? 0 : 1) + .simulate("change", { target: { value } }), clickNavButton: (which: "next" | "prev", navIndex = 0) => { wrapper .find(DatePickerNavbar)