Skip to content

Commit b5173bd

Browse files
authored
Components: Refactor TreeGridCell tests to RTL (#44826)
1 parent 8f0c09d commit b5173bd

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/components/src/tree-grid/test/__snapshots__/cell.js.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ exports[`TreeGridCell uses a child render function to render children 1`] = `
55
role="application"
66
>
77
<table
8-
onKeyDown={[Function]}
98
role="treegrid"
109
>
1110
<tbody>
@@ -14,8 +13,7 @@ exports[`TreeGridCell uses a child render function to render children 1`] = `
1413
role="gridcell"
1514
>
1615
<button
17-
className="my-button"
18-
onFocus={[Function]}
16+
class="my-button"
1917
>
2018
Click Me!
2119
</button>

packages/components/src/tree-grid/test/cell.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* External dependencies
33
*/
4-
import TestRenderer from 'react-test-renderer';
4+
import { render } from '@testing-library/react';
55

66
/**
77
* WordPress dependencies
@@ -21,7 +21,7 @@ const TestButton = forwardRef( ( { ...props }, ref ) => (
2121
describe( 'TreeGridCell', () => {
2222
it( 'requires TreeGrid to be declared as a parent component somewhere in the component hierarchy', () => {
2323
expect( () =>
24-
TestRenderer.create(
24+
render(
2525
<TreeGridCell>
2626
{ ( props ) => (
2727
<TestButton className="my-button" { ...props }>
@@ -35,7 +35,7 @@ describe( 'TreeGridCell', () => {
3535
} );
3636

3737
it( 'uses a child render function to render children', () => {
38-
const renderer = TestRenderer.create(
38+
const { container } = render(
3939
<TreeGrid>
4040
<tr>
4141
<TreeGridCell>
@@ -49,6 +49,6 @@ describe( 'TreeGridCell', () => {
4949
</TreeGrid>
5050
);
5151

52-
expect( renderer.toJSON() ).toMatchSnapshot();
52+
expect( container.firstChild ).toMatchSnapshot();
5353
} );
5454
} );

0 commit comments

Comments
 (0)