File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ var NavItem = React.createClass({
1212 active : React . PropTypes . bool ,
1313 disabled : React . PropTypes . bool ,
1414 href : React . PropTypes . string ,
15- title : React . PropTypes . string
15+ title : React . PropTypes . string ,
16+ target : React . PropTypes . string
1617 } ,
1718
1819 getDefaultProps : function ( ) {
@@ -32,6 +33,7 @@ var NavItem = React.createClass({
3233 < a
3334 href = { this . props . href }
3435 title = { this . props . title }
36+ target = { this . props . target }
3537 onClick = { this . handleClick }
3638 ref = "anchor" >
3739 { this . props . children }
Original file line number Diff line number Diff line change @@ -47,4 +47,12 @@ describe('NavItem', function () {
4747 var instance = ReactTestUtils . renderIntoDocument ( < NavItem disabled = { true } onSelect = { handleSelect } > { content } </ NavItem > ) ;
4848 ReactTestUtils . Simulate . click ( ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'span' ) ) ;
4949 } ) ;
50+
51+ it ( 'Should set target attribute on anchor' , function ( ) {
52+ var instance = ReactTestUtils . renderIntoDocument (
53+ < NavItem href = "/some/unique-thing/" target = "_blank" > Item content</ NavItem >
54+ ) ;
55+ var linkElement = ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'a' ) . getDOMNode ( ) ;
56+ assert . equal ( linkElement . target , '_blank' ) ;
57+ } ) ;
5058} ) ;
You can’t perform that action at this time.
0 commit comments