@@ -16,29 +16,23 @@ describe('DropdownMenu', () => {
1616 ) ;
1717 } ;
1818
19- it ( 'should render the dropdown button' , ( ) => {
19+ it ( 'should render the dropdown button' , ( ) => {
2020 renderDropdown ( ) ;
2121
2222 const button = screen . getByRole ( 'button' , { name : 'More options' } ) ;
2323 expect ( button ) . toBeInTheDocument ( ) ;
24+
25+ expect ( screen . queryByRole ( 'menu' ) ) . not . toBeInTheDocument ( ) ;
2426 } ) ;
2527
26- it ( 'should open the dropdown menu when button is clicked' , ( ) => {
28+ it ( 'should open dropdown and render menu items when button is clicked' , ( ) => {
2729 renderDropdown ( ) ;
2830
2931 const button = screen . getByRole ( 'button' , { name : 'More options' } ) ;
3032
3133 fireEvent . click ( button ) ;
3234
33- const menu = screen . getByRole ( 'menu' ) ;
34- expect ( menu ) . toBeInTheDocument ( ) ;
35- } ) ;
36-
37- it ( 'should render menu items when opened' , ( ) => {
38- renderDropdown ( ) ;
39-
40- const button = screen . getByRole ( 'button' , { name : 'More options' } ) ;
41- fireEvent . click ( button ) ;
35+ expect ( screen . getByRole ( 'menu' ) ) . toBeInTheDocument ( ) ;
4236
4337 expect ( screen . getByText ( 'Item One' ) ) . toBeInTheDocument ( ) ;
4438 expect ( screen . getByText ( 'Item Two' ) ) . toBeInTheDocument ( ) ;
@@ -59,21 +53,5 @@ describe('DropdownMenu', () => {
5953 } ) ;
6054 } ) ;
6155
62- it ( 'should support custom alignment' , ( ) => {
63- render (
64- < DropdownMenu
65- aria-label = "Aligned dropdown"
66- align = { DropdownMenuAlignment . LEFT }
67- >
68- < li role = "menuitem" > Left Item</ li >
69- </ DropdownMenu >
70- ) ;
71-
72- const button = screen . getByRole ( 'button' , { name : 'Aligned dropdown' } ) ;
73-
74- fireEvent . click ( button ) ;
75-
76- const menu = screen . getByRole ( 'menu' ) ;
77- expect ( menu ) . toBeInTheDocument ( ) ;
78- } ) ;
56+
7957} ) ;
0 commit comments