Skip to content

Commit 73e001a

Browse files
author
Kevin Pan
committed
relaxing propTypes for CalendarWeek
1 parent d5f747e commit 73e001a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/components/CalendarWeek.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React from 'react';
2-
import { forbidExtraProps, or, childrenOfType } from 'airbnb-prop-types';
3-
4-
import CalendarDay from './CalendarDay';
5-
import CustomizableCalendarDay from './CustomizableCalendarDay';
2+
import PropTypes from 'prop-types';
3+
import { forbidExtraProps } from 'airbnb-prop-types';
64

75
const propTypes = forbidExtraProps({
8-
children: or([childrenOfType(CalendarDay), childrenOfType(CustomizableCalendarDay)]).isRequired,
6+
children: PropTypes.node.isRequired,
97
});
108

119
export default function CalendarWeek({ children }) {

test/components/CalendarWeek_spec.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@ describe('CalendarWeek', () => {
1515
));
1616
expect(wrapper.is('tr')).to.equal(true);
1717
});
18+
it('accepts a React node', () => {
19+
const wrapper = shallow((
20+
<CalendarWeek>
21+
<></>
22+
</CalendarWeek>
23+
));
24+
expect(wrapper.is('tr')).to.equal(true);
25+
expect(wrapper).to.not.throw();
26+
});
1827
});

0 commit comments

Comments
 (0)