Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: Refactor TreeGridCell tests to RTL #44826

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ exports[`TreeGridCell uses a child render function to render children 1`] = `
role="application"
>
<table
onKeyDown={[Function]}
role="treegrid"
>
<tbody>
Expand All @@ -14,8 +13,7 @@ exports[`TreeGridCell uses a child render function to render children 1`] = `
role="gridcell"
>
<button
className="my-button"
onFocus={[Function]}
class="my-button"
>
Click Me!
</button>
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/tree-grid/test/cell.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import TestRenderer from 'react-test-renderer';
import { render } from '@testing-library/react';

/**
* WordPress dependencies
Expand All @@ -21,7 +21,7 @@ const TestButton = forwardRef( ( { ...props }, ref ) => (
describe( 'TreeGridCell', () => {
it( 'requires TreeGrid to be declared as a parent component somewhere in the component hierarchy', () => {
expect( () =>
TestRenderer.create(
render(
<TreeGridCell>
{ ( props ) => (
<TestButton className="my-button" { ...props }>
Expand All @@ -35,7 +35,7 @@ describe( 'TreeGridCell', () => {
} );

it( 'uses a child render function to render children', () => {
const renderer = TestRenderer.create(
const { container } = render(
<TreeGrid>
<tr>
<TreeGridCell>
Expand All @@ -49,6 +49,6 @@ describe( 'TreeGridCell', () => {
</TreeGrid>
);

expect( renderer.toJSON() ).toMatchSnapshot();
expect( container.firstChild ).toMatchSnapshot();
} );
} );