Skip to content

Commit

Permalink
Add a test case for #95
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Nov 20, 2015
1 parent 75a1e22 commit 250b642
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/DayPicker.js
Expand Up @@ -414,6 +414,26 @@ describe("DayPicker", () => {
expect(dayPickerEl.state.currentMonth.getFullYear()).to.equal(2016);
});

it("shows the month specified in toMonth", () => {
const dayPickerEl = TestUtils.renderIntoDocument(
<DayPicker initialMonth={new Date(2015, 6)} toMonth={new Date(2015, 11)} />
);
dayPickerEl.showMonth(new Date(2015, 11));

expect(dayPickerEl.state.currentMonth.getMonth()).to.equal(11);
expect(dayPickerEl.state.currentMonth.getFullYear()).to.equal(2015);
});

it("shows the month specified in fromMonth", () => {
const dayPickerEl = TestUtils.renderIntoDocument(
<DayPicker fromMonth={new Date(2015, 5)} />
);
dayPickerEl.showMonth(new Date(2015, 5));

expect(dayPickerEl.state.currentMonth.getMonth()).to.equal(5);
expect(dayPickerEl.state.currentMonth.getFullYear()).to.equal(2015);
});

it("does not show the month if after `toMonth`", () => {
const dayPickerEl = TestUtils.renderIntoDocument(
<DayPicker initialMonth={new Date(2015, 6)} toMonth={new Date(2015, 6)} />
Expand Down

0 comments on commit 250b642

Please sign in to comment.