Skip to content

Commit 216ff2c

Browse files
committed
Address the review comments
1 parent a47243b commit 216ff2c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/AbstractMenu.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ export default class AbstractMenu extends Component {
163163
this.setState({ selectedItem: null, forceSubMenuOpen: false });
164164
};
165165

166+
/**
167+
* Render all the children.
168+
* It has a `childIndexRef` parameter to be able to construct the child
169+
* indexes properly. A reference was needed for this function because this
170+
* is a recursive function that could mutate the index and pass it back to
171+
* the caller. That parameter should always be undefined while calling from
172+
* outside.
173+
* TODO: Rewrite this function in a way that we don't need this reference.
174+
*/
166175
renderChildren = (children, childIndexRef = { value: -1 }) =>
167176
React.Children.map(children, (child) => {
168177
let currentChildIndexRef = childIndexRef;

tests/ContextMenu.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ describe('ContextMenu tests', () => {
313313
type: MenuItem
314314
});
315315

316-
// Press enter select it.
316+
// Press enter to select it.
317317
document.dispatchEvent(enter);
318318
// The selected item should be preserved and not reset.
319319
expect(component.state().selectedItem).toEqual({

0 commit comments

Comments
 (0)