Skip to content

Commit

Permalink
Added test to check if the prev month button is disabled if the curre…
Browse files Browse the repository at this point in the history
…nt month is before the minDate month
  • Loading branch information
yulric committed Oct 7, 2015
1 parent 83327bf commit 0142821
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/date-picker/calendar-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ describe(`Calendar`, () => {
expect(calendarToolbar.props.prevMonth).to.be.false;
});

it(`should disable the previous month button is the current month is before the minDate month prop`, () => {
let initialDate = new Date();
let minDate = new Date(initialDate.toDateString());
minDate.setMonth(initialDate.getMonth() + 1);

let render = TestUtils.renderIntoDocument(
<ThemedCalendar
initialDate={initialDate}
minDate={minDate}
/>
);
let calendarToolbar = TestUtils.findRenderedComponentWithType(render, CalendarToolbar);

expect(calendarToolbar.props.prevMonth).to.be.false;
});

it(`should enable the previous month button if the current month is after the minDate month prop`, () => {
let initialDate = new Date();
let minDate = new Date(initialDate.toDateString());
Expand Down

0 comments on commit 0142821

Please sign in to comment.