Skip to content

Commit

Permalink
test: case
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-ice committed Aug 15, 2024
1 parent f433194 commit e685e68
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/MenuItem.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,27 @@ describe('MenuItem', () => {

expect(container.querySelector('li')).toMatchSnapshot();
});

it('should set extra to group option', () => {
const { container } = render(
<Menu
items={[
{
type: 'group',
label: 'Top Menu Group with children',
children: [
{
label: 'Menu Item 1',
key: 'top',
extra: '⌘B',
},
],
},
]}
/>,
);

expect(container.querySelector('li')).toMatchSnapshot();
});
});
});
33 changes: 33 additions & 0 deletions tests/__snapshots__/MenuItem.spec.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`MenuItem overwrite default role should set extra to group option 1`] = `
<li
class="rc-menu-item-group"
role="presentation"
>
<div
class="rc-menu-item-group-title"
role="presentation"
title="Top Menu Item"
>
Top Menu Item
</div>
<ul
class="rc-menu-item-group-list"
role="group"
>
<li
class="rc-menu-item"
data-menu-id="rc-menu-uuid-test-top"
role="menuitem"
tabindex="-1"
>
Top Menu Item
<span
class="rc-menu-extra"
>
⌘B
</span>
</li>
</ul>
</li>
`;

exports[`MenuItem overwrite default role should set extra to option 1`] = `
<li
class="rc-menu-item"
Expand Down

0 comments on commit e685e68

Please sign in to comment.