Skip to content

Commit debfd8a

Browse files
Fix: use element 'children'
1 parent 6dfdd21 commit debfd8a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/native/src/lib/ToBeEmptyElementAssertion.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,16 @@ export class ToBeEmptyElementAssertion extends Assertion<ReactTestInstance> {
4242
}
4343

4444
private isEmpty(element: ReactTestInstance): boolean {
45-
if(!element?.props?.children) {
45+
const children = element?.children;
46+
47+
if (!children) {
4648
return true;
4749
}
4850

49-
return element?.props?.children.length === 0;
51+
if (Array.isArray(children)) {
52+
return children.length === 0;
53+
}
54+
55+
return false;
5056
}
51-
}
57+
}

0 commit comments

Comments
 (0)