diff --git a/src/__tests__/to-be-visible.tsx b/src/__tests__/to-be-visible.tsx index 281c02a..651e2fc 100644 --- a/src/__tests__/to-be-visible.tsx +++ b/src/__tests__/to-be-visible.tsx @@ -20,7 +20,7 @@ describe('.toBeVisible', () => { test('handles view with display "none"', () => { const { getByTestId } = render(); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); }); test('handles ancestor view with 0 opacity', () => { @@ -31,7 +31,7 @@ describe('.toBeVisible', () => { , ); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); }); test('handles ancestor view with display "none"', () => { @@ -42,7 +42,7 @@ describe('.toBeVisible', () => { , ); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); }); test('handles empty modal', () => { @@ -77,12 +77,12 @@ describe('.toBeVisible', () => { test('handles not visible modal', () => { const { getByTestId } = render(); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); }); test('handles inaccessible view (iOS)', () => { const { getByTestId, update } = render(); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); update(); expect(getByTestId('test')).toBeVisible(); @@ -96,14 +96,14 @@ describe('.toBeVisible', () => { , ); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); }); test('handles inaccessible view (Android)', () => { const { getByTestId, update } = render( , ); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); update(); expect(getByTestId('test')).toBeVisible(); @@ -117,7 +117,7 @@ describe('.toBeVisible', () => { , ); - expect(getByTestId('test')).not.toBeVisible(); + expect(getByTestId('test', { includeHiddenElements: true })).not.toBeVisible(); }); test('handles null elements', () => { diff --git a/src/__tests__/to-have-text-content.tsx b/src/__tests__/to-have-text-content.tsx index 3770d56..b43861a 100644 --- a/src/__tests__/to-have-text-content.tsx +++ b/src/__tests__/to-have-text-content.tsx @@ -74,7 +74,7 @@ describe('.toHaveTextContent', () => { test('can handle multiple levels with no explicit children prop', () => { const NoChildren = ({ text }: { text: string }) => {text}; const answer = 'Answer'; - const { container } = render( + const { root } = render( {answer} @@ -86,27 +86,27 @@ describe('.toHaveTextContent', () => { , ); - expect(container).toHaveTextContent(/^Answer: 42$/); + expect(root).toHaveTextContent(/^Answer: 42$/); }); test('throws when no match is found', () => { - const { container } = render(Should succeed); + const { root } = render(Should succeed); expect(() => { - expect(container).toHaveTextContent('Should fail'); + expect(root).toHaveTextContent('Should fail'); }).toThrow(); }); test('does not throw error with empty content', () => { - const { container } = render(); - expect(container).toHaveTextContent(''); + const { root } = render(); + expect(root).toHaveTextContent(''); }); test('is case-sensitive', () => { - const { container } = render(Sensitive text); + const { root } = render(Sensitive text); - expect(container).toHaveTextContent('Sensitive text'); - expect(container).not.toHaveTextContent('sensitive text'); + expect(root).toHaveTextContent('Sensitive text'); + expect(root).not.toHaveTextContent('sensitive text'); }); test('can handle conditional rendering', () => { @@ -124,8 +124,8 @@ describe('.toHaveTextContent', () => { test('can handle text with an interpolated variable', () => { const variable = 'variable'; - const { container } = render(With a {variable}); + const { root } = render(With a {variable}); - expect(container).toHaveTextContent('With a variable'); + expect(root).toHaveTextContent('With a variable'); }); });