mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add test to ensure 'undefined' children is used (#6853)
This commit is contained in:
1 parent
db6ac5c01c
commit
fe2002c3d8
2 files changed
+24
No files matched your search
@@ -223,6 +223,18 @@ describe('ReactElement', function() {
|
||||
expect(console.error.argsForCall.length).toBe(0);
|
||||
});
|
||||
|
||||
it('overrides children if undefined is provided as an argument', function() {
|
||||
var element = React.createElement(ComponentClass, {
|
||||
children: 'text',
|
||||
}, undefined);
|
||||
expect(element.props.children).toBe(undefined);
|
||||
|
||||
var element2 = React.cloneElement(React.createElement(ComponentClass, {
|
||||
children: 'text',
|
||||
}), {}, undefined);
|
||||
expect(element2.props.children).toBe(undefined);
|
||||
});
|
||||
|
||||
it('merges rest arguments onto the children prop in an array', function() {
|
||||
spyOn(console, 'error');
|
||||
var a = 1;
|
||||
|
||||
@@ -117,6 +117,18 @@ describe('ReactJSXElement', function() {
|
||||
expect(console.error.argsForCall.length).toBe(0);
|
||||
});
|
||||
|
||||
it('overrides children if undefined is provided as an argument', function() {
|
||||
var element = <Component children="text">{undefined}</Component>;
|
||||
expect(element.props.children).toBe(undefined);
|
||||
|
||||
var element2 = React.cloneElement(
|
||||
<Component children="text" />,
|
||||
{},
|
||||
undefined
|
||||
);
|
||||
expect(element2.props.children).toBe(undefined);
|
||||
});
|
||||
|
||||
it('merges JSX children onto the children prop in an array', function() {
|
||||
spyOn(console, 'error');
|
||||
var a = 1;
|
||||
|
||||
Reference in new issue
Block a user