Skip to content

Commit

Permalink
test: add test for fragement props (facebook#13565)
Browse files Browse the repository at this point in the history
  • Loading branch information
gebilaoxiong authored and gaearon committed Sep 5, 2018
1 parent 9a110eb commit bb62722
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,21 @@ describe('ReactElementValidator', () => {
);
});

it('warns for fragments with illegal attributes', () => {
class Foo extends React.Component {
render() {
return React.createElement(React.Fragment, {a: 1}, '123');
}
}

expect(() => {
ReactTestUtils.renderIntoDocument(React.createElement(Foo));
}).toWarnDev(
'Invalid prop `a` supplied to `React.Fragment`. React.Fragment ' +
'can only have `key` and `children` props.',
);
});

it('should warn when accessing .type on an element factory', () => {
function TestComponent() {
return <div />;
Expand Down

0 comments on commit bb62722

Please sign in to comment.