Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Sep 18, 2017
1 parent 2c44711 commit 41496c4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/__tests__/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,36 @@ describe('Calendar', () => {
expect(yearView).toHaveLength(1);
});

it('renders maximum allowed view when attempting to externally switch to a view that is not allowed', () => {
const component = mount(
<Calendar
maxDetail="year"
view="year"
/>
);

component.setProps({ view: 'month' });

const yearView = component.find('.react-calendar__year-view');

expect(yearView).toHaveLength(1);
});

it('renders maximum allowed view when given changed maxDetail', () => {
const component = mount(
<Calendar
maxDetail="month"
view="month"
/>
);

component.setProps({ maxDetail: 'year' });

const yearView = component.find('.react-calendar__year-view');

expect(yearView).toHaveLength(1);
});

it('renders month view when given view = "month"', () => {
const component = mount(
<Calendar view="month" />
Expand Down

0 comments on commit 41496c4

Please sign in to comment.