Skip to content

Commit

Permalink
Fix DatePicker unit test (#3880)
Browse files Browse the repository at this point in the history
DatePicker unit tests started failing in December because
it relied on being able to press "next month". This change
sets the initial month to January.
  • Loading branch information
themadcreator authored Dec 6, 2019
1 parent 6b963ea commit 938b0e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/datetime/test/datePickerTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,10 @@ describe("<DatePicker>", () => {

it("onChange fired when month is changed", () => {
const onChange = sinon.spy();
const { getDay, clickNextMonth } = wrap(<DatePicker onChange={onChange} />);
// must use an initial month otherwise clicking next month in december will fail
const { getDay, clickNextMonth } = wrap(
<DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} onChange={onChange} />,
);
assert.isTrue(onChange.notCalled);
getDay().simulate("click");
assert.isTrue(onChange.calledOnce, "expected onChange called");
Expand Down

1 comment on commit 938b0e1

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix DatePicker unit test (#3880)

Previews: documentation | landing | table

Please sign in to comment.