File tree 3 files changed +10
-5
lines changed
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ function renderDropdownButton (title, i) {
5
5
< DropdownButton bsStyle = { title . toLowerCase ( ) } title = { title } key = { i } >
6
6
< MenuItem eventKey = '1' > Action</ MenuItem >
7
7
< MenuItem eventKey = '2' > Another action</ MenuItem >
8
- < MenuItem eventKey = '3' > Something else here </ MenuItem >
8
+ < MenuItem eventKey = '3' active = { true } > Active Item </ MenuItem >
9
9
< MenuItem divider />
10
10
< MenuItem eventKey = '4' > Separated link</ MenuItem >
11
11
</ DropdownButton >
Original file line number Diff line number Diff line change @@ -9,12 +9,14 @@ const MenuItem = React.createClass({
9
9
title : React . PropTypes . string ,
10
10
target : React . PropTypes . string ,
11
11
onSelect : React . PropTypes . func ,
12
- eventKey : React . PropTypes . any
12
+ eventKey : React . PropTypes . any ,
13
+ active : React . PropTypes . bool
13
14
} ,
14
15
15
16
getDefaultProps ( ) {
16
17
return {
17
- href : '#'
18
+ href : '#' ,
19
+ active : false
18
20
} ;
19
21
} ,
20
22
@@ -36,7 +38,8 @@ const MenuItem = React.createClass({
36
38
render ( ) {
37
39
let classes = {
38
40
'dropdown-header' : this . props . header ,
39
- 'divider' : this . props . divider
41
+ 'divider' : this . props . divider ,
42
+ 'active' : this . props . active
40
43
} ;
41
44
42
45
let children = null ;
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ describe('MenuItem', function () {
18
18
< MenuItem
19
19
className = "test-class"
20
20
href = "#hi-mom!"
21
- title = "hi mom!" >
21
+ title = "hi mom!"
22
+ active = { true } >
22
23
Title
23
24
</ MenuItem >
24
25
) ;
@@ -27,6 +28,7 @@ describe('MenuItem', function () {
27
28
assert ( node . className . match ( / \b t e s t - c l a s s \b / ) ) ;
28
29
assert . equal ( node . getAttribute ( 'href' ) , null ) ;
29
30
assert . equal ( node . getAttribute ( 'title' ) , null ) ;
31
+ assert . ok ( node . className . match ( / \b a c t i v e \b / ) ) ;
30
32
31
33
let anchorNode = ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'a' ) . getDOMNode ( ) ;
32
34
assert . notOk ( anchorNode . className . match ( / \b t e s t - c l a s s \b / ) ) ;
You can’t perform that action at this time.
0 commit comments