react-checkbox-group
Advanced tools
Comparing version
{ | ||
"name": "react-checkbox-group", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Sensible checkbox groups manipulation for DOM.", | ||
@@ -38,3 +38,3 @@ "main": "react-checkbox-group.js", | ||
"jsdom": "^11.3.0", | ||
"mocha": "^4.0.1", | ||
"mocha": "^5.0.0", | ||
"react": "^16.0.0", | ||
@@ -41,0 +41,0 @@ "react-dom": "^16.0.0" |
@@ -96,3 +96,3 @@ 'use strict'; | ||
return _react2.default.Children.map(children, function (child) { | ||
if (!child.$$typeof) { | ||
if (!(child && child.$$typeof)) { | ||
return child; | ||
@@ -99,0 +99,0 @@ } else if (child.type === Checkbox) { |
@@ -71,3 +71,3 @@ import React, {Component} from 'react'; | ||
return React.Children.map(children, child => { | ||
if (!child.$$typeof) { | ||
if (!(child && child.$$typeof)) { | ||
return child; | ||
@@ -74,0 +74,0 @@ } |
@@ -28,7 +28,9 @@ import React from 'react'; | ||
it('Renders correctly when `Checkbox` is not a direct child of `CheckboxGroup` and `checkboxDepth` is passed', function() { | ||
it('Renders correctly when `Checkbox` components at different nesting levels', function() { | ||
const component = renderIntoDocument( | ||
<CheckboxGroup checkboxDepth={2} name="fruit"> | ||
<CheckboxGroup checkboxDepth={3} name="fruit"> | ||
<label><Checkbox value="kiwi"/> Kiwi</label> | ||
<label><Checkbox value="watermelon"/> Watermelon</label> | ||
<div> | ||
<label><Checkbox value="watermelon"/> Watermelon</label> | ||
</div> | ||
</CheckboxGroup> | ||
@@ -40,2 +42,15 @@ ); | ||
it('Renders correctly when one of the `CheckboxGroup` child is null', function() { | ||
const component = renderIntoDocument( | ||
<CheckboxGroup checkboxDepth={3} name="fruit"> | ||
<label><Checkbox value="kiwi"/> Kiwi</label> | ||
{false && ( // or another logical condition which returns `false` | ||
<label><Checkbox value="watermelon"/> Watermelon</label> | ||
)} | ||
</CheckboxGroup> | ||
); | ||
expect(component).to.be.ok; | ||
}); | ||
it('Passes the `name` prop down to the boxes', function() { | ||
@@ -42,0 +57,0 @@ const component = renderIntoDocument( |
Sorry, the diff of this file is not supported yet
64978
61.95%16
14.29%474
2.82%