mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Add unit test to onlyChild to ensure onlyChild returns child element (#8667)
Add unit test to onlyChild to ensure onlyChild returns child element
This commit is contained in:
committed by
Brian Vaughn
parent
ebd83e809e
commit
cd4afca043
@@ -83,15 +83,12 @@ describe('onlyChild', () => {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
|
||||
it('should return the only child', () => {
|
||||
expect(function() {
|
||||
var instance =
|
||||
<WrapComponent>
|
||||
<span />
|
||||
</WrapComponent>;
|
||||
onlyChild(instance.props.children);
|
||||
}).not.toThrow();
|
||||
var instance =
|
||||
<WrapComponent>
|
||||
<span />
|
||||
</WrapComponent>;
|
||||
expect(onlyChild(instance.props.children)).toEqual(<span />);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user