diff --git a/docs/contributors/code/testing-overview.md b/docs/contributors/code/testing-overview.md index fa17909b4cd376..f68469f6a893f4 100644 --- a/docs/contributors/code/testing-overview.md +++ b/docs/contributors/code/testing-overview.md @@ -367,13 +367,13 @@ describe( 'SolarSystem', () => { test( 'should render', () => { const { container } = render( ); - expect( container.firstChild ).toMatchSnapshot(); + expect( container ).toMatchSnapshot(); } ); test( 'should contain mars if planets is true', () => { const { container } = render( ); - expect( container.firstChild ).toMatchSnapshot(); + expect( container ).toMatchSnapshot(); expect( screen.getByText( /mars/i ) ).toBeInTheDocument(); } ); } ); @@ -422,7 +422,7 @@ test( 'should contain mars if planets is true', () => { const { container } = render( ); // Snapshot will catch unintended changes - expect( container.firstChild ).toMatchSnapshot(); + expect( container ).toMatchSnapshot(); // This is what we actually expect to find in our test expect( screen.getByText( /mars/i ) ).toBeInTheDocument(); @@ -447,8 +447,8 @@ Similarly, the `toMatchStyleDiffSnapshot` function allows to snapshot only the d test( 'should render margin', () => { const { container: spacer } = render( ); const { container: spacerWithMargin } = render( ); - expect( spacerWithMargin.firstChild ).toMatchStyleDiffSnapshot( - spacer.firstChild + expect( spacerWithMargin ).toMatchStyleDiffSnapshot( + spacer ); } ); ``` diff --git a/packages/components/src/card/test/__snapshots__/index.tsx.snap b/packages/components/src/card/test/__snapshots__/index.tsx.snap index 2325e13746aa95..2abd66b0067eac 100644 --- a/packages/components/src/card/test/__snapshots__/index.tsx.snap +++ b/packages/components/src/card/test/__snapshots__/index.tsx.snap @@ -90,27 +90,27 @@ Snapshot Diff: - First value + Second value -@@ -5,18 +5,18 @@ - > -
- Header -
-
- Code is Poetry -
+
+ Header +
+
+ Code is Poetry +
`; exports[`Card Card component should add rounded border when the isRounded prop is true 1`] = ` @@ -768,24 +768,25 @@ Snapshot Diff: - First value + Second value -@@ -8,16 +8,16 @@ - > - Code is Poetry +@@ -9,17 +9,17 @@ + > + Code is Poetry +
+