Skip to content
Snippets Groups Projects
Commit 27414a92 authored by Jessie Keck's avatar Jessie Keck Committed by Chris Beer
Browse files

Spread unused NestedMenu props to the MenuItem component.

parent 07034164
Branches
Tags
No related merge requests found
...@@ -54,6 +54,12 @@ describe('NestedMenu', () => { ...@@ -54,6 +54,12 @@ describe('NestedMenu', () => {
expect(wrapper.state().nestedMenuIsOpen).toBe(false); expect(wrapper.state().nestedMenuIsOpen).toBe(false);
}); });
it('spreads options to the MenuItem', () => {
wrapper = createWrapper({ divider: true });
expect(wrapper.find('WithStyles(MenuItem)').props().divider).toBe(true);
});
it('renders the appropriate expand/collapse icon based on the menu open state', () => { it('renders the appropriate expand/collapse icon based on the menu open state', () => {
wrapper = createWrapper(); wrapper = createWrapper();
......
...@@ -38,14 +38,16 @@ export class NestedMenu extends Component { ...@@ -38,14 +38,16 @@ export class NestedMenu extends Component {
} }
/** /**
* Returns the rendered component * Returns the rendered component. Spreads unused props to MenuItem
*/ */
render() { render() {
const { nestedMenuIsOpen } = this.state; const { nestedMenuIsOpen } = this.state;
const { children, icon, label } = this.props; const {
children, icon, label, ...otherProps
} = this.props;
return ( return (
<> <>
<MenuItem onClick={this.handleMenuClick}> <MenuItem onClick={this.handleMenuClick} {...otherProps}>
{icon {icon
&& (<ListItemIcon>{icon}</ListItemIcon>) && (<ListItemIcon>{icon}</ListItemIcon>)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment