From 1d8cd1096591bacebd7369ca775fe53a4a565187 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Mon, 10 Oct 2022 16:19:51 +0300 Subject: [PATCH] Components: Refactor TreeGridCell tests to RTL --- .../src/tree-grid/test/__snapshots__/cell.js.snap | 4 +--- packages/components/src/tree-grid/test/cell.js | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/components/src/tree-grid/test/__snapshots__/cell.js.snap b/packages/components/src/tree-grid/test/__snapshots__/cell.js.snap index 7817c3259bf5aa..2e6955e823dd73 100644 --- a/packages/components/src/tree-grid/test/__snapshots__/cell.js.snap +++ b/packages/components/src/tree-grid/test/__snapshots__/cell.js.snap @@ -5,7 +5,6 @@ exports[`TreeGridCell uses a child render function to render children 1`] = ` role="application" > @@ -14,8 +13,7 @@ exports[`TreeGridCell uses a child render function to render children 1`] = ` role="gridcell" > diff --git a/packages/components/src/tree-grid/test/cell.js b/packages/components/src/tree-grid/test/cell.js index c98567fb77a518..4caf3857823699 100644 --- a/packages/components/src/tree-grid/test/cell.js +++ b/packages/components/src/tree-grid/test/cell.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import TestRenderer from 'react-test-renderer'; +import { render } from '@testing-library/react'; /** * WordPress dependencies @@ -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( { ( props ) => ( @@ -35,7 +35,7 @@ describe( 'TreeGridCell', () => { } ); it( 'uses a child render function to render children', () => { - const renderer = TestRenderer.create( + const { container } = render( @@ -49,6 +49,6 @@ describe( 'TreeGridCell', () => { ); - expect( renderer.toJSON() ).toMatchSnapshot(); + expect( container.firstChild ).toMatchSnapshot(); } ); } );