diff --git a/packages/components/src/popover/test/index.js b/packages/components/src/popover/test/index.js index 98dc26f20699a1..68ede81280f4b9 100644 --- a/packages/components/src/popover/test/index.js +++ b/packages/components/src/popover/test/index.js @@ -1,7 +1,12 @@ /** * External dependencies */ -import { act, render } from '@testing-library/react'; +import { act, render, screen } from '@testing-library/react'; + +/** + * WordPress dependencies + */ +import { useRef } from '@wordpress/element'; /** * Internal dependencies @@ -44,4 +49,21 @@ describe( 'Popover', () => { expect( result.container.querySelector( 'span' ) ).toMatchSnapshot(); } ); + + it( 'should render correctly when anchorRef is provided', () => { + const PopoverWithAnchor = ( args ) => { + const anchorRef = useRef( null ); + + return ( +
Anchor
+