Skip to content

Commit 285725c

Browse files
committed
Revert "Add unit test"
This reverts commit 7a9c5d1.
1 parent 00ec8ae commit 285725c

1 file changed

Lines changed: 0 additions & 92 deletions

File tree

packages/components/src/menu/test/index.tsx

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -611,98 +611,6 @@ describe( 'Menu', () => {
611611
).toBeChecked();
612612
} );
613613

614-
it( 'should allow resetting checked radio items from a separate menu', async () => {
615-
const SiblingMenus = () => {
616-
const [ selectedOption, setSelectedOption ] = useState<
617-
'menu-a-option' | 'menu-b-option'
618-
>( 'menu-a-option' );
619-
620-
return (
621-
<>
622-
<Menu>
623-
<Menu.TriggerButton>Open menu A</Menu.TriggerButton>
624-
<Menu.Popover>
625-
<Menu.Group>
626-
<Menu.RadioItem
627-
name="menu-a"
628-
value="menu-a-option"
629-
checked={
630-
selectedOption === 'menu-a-option'
631-
}
632-
onChange={ () =>
633-
setSelectedOption( 'menu-a-option' )
634-
}
635-
>
636-
Menu A option
637-
</Menu.RadioItem>
638-
</Menu.Group>
639-
</Menu.Popover>
640-
</Menu>
641-
<Menu>
642-
<Menu.TriggerButton>Open menu B</Menu.TriggerButton>
643-
<Menu.Popover>
644-
<Menu.Group>
645-
<Menu.RadioItem
646-
name="menu-b"
647-
value="menu-b-option"
648-
checked={
649-
selectedOption === 'menu-b-option'
650-
}
651-
onChange={ () =>
652-
setSelectedOption( 'menu-b-option' )
653-
}
654-
>
655-
Menu B option
656-
</Menu.RadioItem>
657-
</Menu.Group>
658-
</Menu.Popover>
659-
</Menu>
660-
</>
661-
);
662-
};
663-
664-
render( <SiblingMenus /> );
665-
666-
const openMenuA = screen.getByRole( 'button', {
667-
name: 'Open menu A',
668-
} );
669-
const openMenuB = screen.getByRole( 'button', {
670-
name: 'Open menu B',
671-
} );
672-
673-
// Open the first menu and verify its checked state.
674-
await click( openMenuA );
675-
const menuAOptionInitial = screen.getByRole( 'menuitemradio', {
676-
name: 'Menu A option',
677-
} );
678-
expect( menuAOptionInitial ).toBeChecked();
679-
680-
// Close the first menu.
681-
await click( document.body );
682-
683-
// Open the second menu, change the selection there.
684-
await click( openMenuB );
685-
const menuBOption = screen.getByRole( 'menuitemradio', {
686-
name: 'Menu B option',
687-
} );
688-
expect( menuBOption ).not.toBeChecked();
689-
690-
await click( menuBOption );
691-
expect( menuBOption ).toBeChecked();
692-
693-
// Close the second menu.
694-
await click( document.body );
695-
696-
// Reopen the first menu: its radio item should now reflect the
697-
// updated external state and be unchecked.
698-
await click( openMenuA );
699-
700-
const menuAOption = screen.getByRole( 'menuitemradio', {
701-
name: 'Menu A option',
702-
} );
703-
expect( menuAOption ).not.toBeChecked();
704-
} );
705-
706614
it( 'should check checkbox items and keep the menu open when clicking (controlled)', async () => {
707615
const onCheckboxValueChangeSpy = jest.fn();
708616

0 commit comments

Comments
 (0)