mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
test: add test for fragement props (#13565)
This commit is contained in:
@@ -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 />;
|
||||
|
||||
Reference in New Issue
Block a user