Skip to content

Commit a1d5387

Browse files
committed
test(to-be-empty-element): validate empty element detection
1 parent 69a1359 commit a1d5387

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from 'react';
2+
import { Text, View } from 'react-native';
3+
4+
import { render, screen } from '../..';
5+
6+
it('identifies empty elements', async () => {
7+
const Component = () => (
8+
<View>
9+
<View testID="empty" />
10+
<View testID="with-children">
11+
<Text>Content</Text>
12+
</View>
13+
</View>
14+
);
15+
16+
await render(<Component />);
17+
18+
expect(screen.getByTestId('empty')).toBeEmptyElement();
19+
expect(screen.getByTestId('with-children')).not.toBeEmptyElement();
20+
});

test-coverage-progress.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ test(matchers/to-have-style): Validates toHaveStyle matcher checks if element ha
2323
test(matchers/to-be-busy): Validates toBeBusy matcher checks if element is busy via accessibilityState - critical matcher users depend on for testing loading states in components. Coverage: 66.66% statements (was 37.5%), 100% branches, 50% functions for to-be-busy.ts. Covered main matcher function, computeAriaBusy logic, busy and not-busy states. Uncovered: error message formatting (lines 15-22).
2424
test(matchers/to-have-text-content): Validates toHaveTextContent matcher checks if element has expected text content - critical matcher users depend on for verifying text content in components. Coverage: 69.69% statements (was 27.27%), 33.33% branches, 50% functions for to-have-text-content.ts. Covered main matcher function, text content retrieval and matching. Uncovered: error message formatting (lines 22-31).
2525
test(wait-for): Validates waitFor onTimeout callback customizes timeout error messages - critical feature users depend on for customizing error messages when async conditions timeout. Coverage: 67.5% statements (was 65%), 71.42% branches (was 68.96%), 100% functions for wait-for.ts. Covered onTimeout callback invocation and error replacement (lines 184-188). Uncovered: type checking (lines 33-34), fake timers path (lines 47-95), timer switching errors (lines 121-127), non-Error to Error conversion (lines 171-172).
26+
test(matchers/to-be-empty-element): Validates toBeEmptyElement matcher checks if element has no host element children - critical matcher users depend on for testing empty states, loading states, and components that should render nothing. Coverage: 73.07% statements (was 34.61%), 100% branches, 50% functions for to-be-empty-element.ts. Covered main matcher function, children filtering logic, both positive and negative (.not) variants. Uncovered: error message formatting (lines 18-24).

0 commit comments

Comments
 (0)