Skip to content

Commit

Permalink
Merge pull request alibaba-fusion#3691 from bindoon/fix-menu-item
Browse files Browse the repository at this point in the history
fix(Menu): bug of mode=popup with only 1 children Item
  • Loading branch information
youluna authored Jan 19, 2022
2 parents 593483c + 4426f30 commit a2ee591
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/menu/view/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const getIndicatorsItem = (items, isPlaceholder, prefix = '', renderMore) => {
const addIndicators = ({ children, lastVisibleIndex, prefix, renderMore }) => {
const arr = [];

children.forEach((child, index) => {
React.Children.forEach(children, (child, index) => {
if (!child) {
return;
}
Expand Down
11 changes: 11 additions & 0 deletions test/menu/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ describe('Menu', () => {
assert(item.find('.next-menu-item-helper').text() === 'helper');
});

it('should render menu item with mode=popup && only 1 item', () => {
wrapper = mount(
<Menu hozInLine direction="hoz" mode="popup">
<Item key="1" className="popup-menu-item">First</Item>
<Item key="2" className="popup-menu-item">secoond</Item>
</Menu>
);
const item = wrapper.find('.next-menu-item');
assert(item.find('.popup-menu-item').length === 2);
});

it('Group/SubMenu should accepct string/number/node', () => {
wrapper = mount(
<Menu defaultOpenKeys={['sub-menu']}>
Expand Down

0 comments on commit a2ee591

Please sign in to comment.