We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 09b4ce3 + 387a9e9 commit 4c15228Copy full SHA for 4c15228
src/__tests__/index.test.js
@@ -24,7 +24,7 @@ describe('reactTreeWalker', () => {
24
}
25
26
render() {
27
- return <div>{this.props.children}</div>
+ return this.props.children
28
29
30
@@ -46,6 +46,7 @@ describe('reactTreeWalker', () => {
46
<Bob>
47
<Foo something={async ? () => resolveLater(4) : 4}>
48
<Foo something={async ? () => resolveLater(5) : 5} />
49
+ <Foo something={async ? () => resolveLater(6) : 6} />
50
</Foo>
51
</Bob>
52
<div>hi!</div>
@@ -66,7 +67,7 @@ describe('reactTreeWalker', () => {
66
67
68
69
return reactTreeWalker(tree, visitor).then(() => {
- const expected = [1, 2, 4, 5, 3]
70
+ const expected = [1, 2, 4, 5, 6, 3]
71
expect(actual).toEqual(expected)
72
})
73
@@ -85,7 +86,7 @@ describe('reactTreeWalker', () => {
85
86
return true
87
88
89
90
91
92
src/index.js
@@ -68,7 +68,7 @@ export default function reactTreeWalker(element, visitor, context, options = def
if (child == null) {
// If no children then we can't traverse. We've reached the leaf.
resolve()
- } else if (isChildren) {
+ } else if (isChildren || Children.count(child)) {
// If its a react Children collection we need to breadth-first
// traverse each of them.
74
const mapper = aChild =>
0 commit comments