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.
1 parent eeb35d1 commit 4138b62Copy full SHA for 4138b62
src/to-have-text-content.ts
@@ -9,7 +9,7 @@ function collectNormalizedText(element: ReactTestInstance) {
9
10
function collectChildrenText(element: ReactTestInstance | string): string[] {
11
if (typeof element === 'string') return [element];
12
- if (!element || !element.children) return [];
+ if (!element?.children) return [];
13
14
const result: string[] = [];
15
element.children.forEach((child) => {
0 commit comments