diff --git a/src/matchers/__tests__/to-contain-element.test.tsx b/src/matchers/__tests__/to-contain-element.test.tsx new file mode 100644 index 00000000..92fbaaf1 --- /dev/null +++ b/src/matchers/__tests__/to-contain-element.test.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; +import { Text, View } from 'react-native'; + +import { render, screen } from '../..'; + +it('checks if container element contains child element', async () => { + const Component = () => ( + + Child content + + ); + + await render(); + + const container = screen.getByTestId('container'); + const child = screen.getByTestId('child'); + + expect(container).toContainElement(child); +}); diff --git a/test-coverage-progress.txt b/test-coverage-progress.txt index 5c4c09b2..4691bab5 100644 --- a/test-coverage-progress.txt +++ b/test-coverage-progress.txt @@ -13,3 +13,4 @@ test(fire-event): Validates fireEvent.press invokes event handler on element - c test(matchers/to-be-visible): Validates toBeVisible matcher correctly identifies visible elements - critical matcher users depend on for testing UI visibility state. Coverage: 77.04% statements (was 21.31%), 50% branches, 75% functions for to-be-visible.ts. Covered main matcher function, isElementVisible core logic, parent traversal. Uncovered: error message formatting, hidden-from-accessibility edge cases, style-based hiding (opacity/display), modal visibility check. test(matchers/to-have-prop): Validates toHaveProp matcher checks element props with optional value matching - critical matcher users depend on for verifying component props. Coverage: 49.09% statements (was 12.72%), 100% branches, 33.33% functions for to-have-prop.ts. Covered main matcher function, prop existence check, value comparison. Uncovered: error message formatting (lines 25-41), formatProp helper (lines 45-55). test(matchers/to-be-disabled): Validates toBeDisabled and toBeEnabled matchers check element disabled state via accessibilityState - critical matcher users depend on for testing disabled/enabled UI states. Coverage: 70.37% statements (was 22.22%), 83.33% branches, 60% functions for to-be-disabled.ts. Covered main matcher functions, computeAriaDisabled logic, both matchers. Uncovered: error message formatting (lines 17-24, 36-43). +test(matchers/to-contain-element): Validates toContainElement matcher checks if container element contains child element - critical matcher users depend on for testing component hierarchies and element relationships. Coverage: 75.67% statements (was 21.62%), 100% branches, 50% functions for to-contain-element.ts. Covered main matcher function, element containment check via queryAll. Uncovered: error message formatting (lines 27-35).