-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[added] property disabled on MenuItem #606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| function onSelectAlert(eventKey, href, target) { | ||
| alert('Alert from menu item.\neventKey: "' + eventKey + '"\nhref: "' + href + '"'); | ||
| } | ||
|
|
||
| function preventDefault() {} | ||
|
|
||
| const MenuItems = ( | ||
| <div className="clearfix"> | ||
| <ul className="dropdown-menu open"> | ||
| <MenuItem header>Header</MenuItem> | ||
| <MenuItem onSelect={preventDefault}>link</MenuItem> | ||
| <MenuItem divider/> | ||
| <MenuItem header>Header</MenuItem> | ||
| <MenuItem onSelect={preventDefault}>link</MenuItem> | ||
| <MenuItem disabled>disabled</MenuItem> | ||
| <MenuItem title="See? I have a title." onSelect={preventDefault}> | ||
| link with title | ||
| </MenuItem> | ||
| <MenuItem eventKey={1} href="#someHref" onSelect={onSelectAlert}> | ||
| link that alerts | ||
| </MenuItem> | ||
| </ul> | ||
| </div> | ||
| ); | ||
|
|
||
| React.render(MenuItems, mountNode); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,4 +107,13 @@ describe('MenuItem', function () { | |
| ); | ||
| ReactTestUtils.Simulate.click(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'a')); | ||
| }); | ||
|
|
||
| it('Should be `disabled` link', function () { | ||
| let instance = ReactTestUtils.renderIntoDocument( | ||
| <MenuItem disabled> | ||
| Title | ||
| </MenuItem> | ||
| ); | ||
| assert.ok(instance.getDOMNode().className.match(/\bdisabled\b/)); | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps adding a test for the click event to ensure that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is covered in the dropdown-revisited branch now. |
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this, though I'm sure I'll have this cleaned up in the dropdown revisited branch so I guess we can live with it in the time being.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this cleaned up in the dropdown-revisited branch now.