Skip to content

Commit

Permalink
migrate unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1008 committed Apr 28, 2023
1 parent 09f3bee commit df2694d
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import { arrowLeft, arrowRight, arrowUp, arrowDown } from '@wordpress/icons';
/**
* Internal dependencies
*/
import DropdownMenu from '../';
import { MenuItem } from '../../';
import DropdownMenu from '..';
import { MenuItem } from '../..';

describe( 'DropdownMenu', () => {
it( 'should not render when neither controls nor children are assigned', () => {
render( <DropdownMenu /> );
render( <DropdownMenu label="Open dropdown" /> );

// The button toggle should not even be rendered
expect( screen.queryByRole( 'button' ) ).not.toBeInTheDocument();
} );

it( 'should not render when controls are empty and children is not specified', () => {
render( <DropdownMenu controls={ [] } /> );
render( <DropdownMenu label="Open dropdown" controls={ [] } /> );

// The button toggle should not even be rendered
expect( screen.queryByRole( 'button' ) ).not.toBeInTheDocument();
Expand Down Expand Up @@ -56,7 +56,7 @@ describe( 'DropdownMenu', () => {
},
];

render( <DropdownMenu controls={ controls } /> );
render( <DropdownMenu label="Open dropdown" controls={ controls } /> );

// Move focus on the toggle button
await user.tab();
Expand All @@ -78,6 +78,7 @@ describe( 'DropdownMenu', () => {

render(
<DropdownMenu
label="Open dropdown"
children={ ( { onClose } ) => <MenuItem onClick={ onClose } /> }
/>
);
Expand Down

0 comments on commit df2694d

Please sign in to comment.