File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,14 +16,15 @@ class ListGroup extends React.Component {
1616 } else if ( React . Children . count ( this . props . children ) === 1 && ! Array . isArray ( this . props . children ) ) {
1717 let child = this . props . children ;
1818
19- childrenAnchors = child . props . href ? true : false ;
19+ childrenAnchors = this . isAnchor ( child . props ) ;
2020
2121 } else {
2222
2323 childrenAnchors = Array . prototype . some . call ( this . props . children , ( child ) => {
24- return ! Array . isArray ( child ) ? child . props . href : Array . prototype . some . call ( child , ( subChild ) => {
25- return subChild . props . href ;
24+ return ! Array . isArray ( child ) ? this . isAnchor ( child . props ) : Array . prototype . some . call ( child , ( subChild ) => {
25+ return this . isAnchor ( subChild . props ) ;
2626 } ) ;
27+
2728 } ) ;
2829
2930 }
@@ -35,6 +36,10 @@ class ListGroup extends React.Component {
3536 }
3637 }
3738
39+ isAnchor ( props ) {
40+ return ( props . href || props . onClick ) ;
41+ }
42+
3843 renderUL ( items ) {
3944 let listItems = ValidComponentChildren . map ( items ,
4045 ( item , index ) => cloneElement ( item , { listItem : true } )
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ const ListGroupItem = React.createClass({
3131 classes . active = this . props . active ;
3232 classes . disabled = this . props . disabled ;
3333
34- if ( this . props . href || this . props . target || this . props . onClick ) {
34+ if ( this . props . href || this . props . onClick ) {
3535 return this . renderAnchor ( classes ) ;
3636 } else if ( this . props . listItem ) {
3737 return this . renderLi ( classes ) ;
Original file line number Diff line number Diff line change @@ -40,9 +40,6 @@ const TabbedArea = React.createClass({
4040 let defaultActiveKey = this . props . defaultActiveKey != null ?
4141 this . props . defaultActiveKey : getDefaultActiveKeyFromChildren ( this . props . children ) ;
4242
43- // TODO: In __DEV__ mode warn via `console.warn` if no `defaultActiveKey` has
44- // been set by this point, invalid children or missing key properties are likely the cause.
45-
4643 return {
4744 activeKey : defaultActiveKey ,
4845 previousActiveKey : null
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactTestUtils from 'react/lib/ReactTestUtils' ;
3- import Navbar from '../lib /Navbar' ;
4- import CollapsableNav from '../lib /CollapsableNav' ;
5- import Nav from '../lib /Nav' ;
6- import NavItem from '../lib /NavItem' ;
3+ import Navbar from '../src /Navbar' ;
4+ import CollapsableNav from '../src /CollapsableNav' ;
5+ import Nav from '../src /Nav' ;
6+ import NavItem from '../src /NavItem' ;
77
88describe ( 'CollapsableNav' , function ( ) {
99 it ( 'Should create div and add collapse class' , function ( ) {
Original file line number Diff line number Diff line change @@ -120,4 +120,20 @@ describe('ListGroup', function () {
120120 assert . equal ( React . findDOMNode ( instance ) . lastChild . nodeName , 'SPAN' ) ;
121121 assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'list-group' ) ) ;
122122 } ) ;
123+
124+
125+
126+ it ( 'Should output a "div" when "ListGroupItem" children have an onClick handler' , function ( ) {
127+ let instance = ReactTestUtils . renderIntoDocument (
128+ < ListGroup >
129+ < ListGroupItem onClick = { ( ) => null } > 1st Child</ ListGroupItem >
130+ < ListGroupItem > 2nd Child</ ListGroupItem >
131+ </ ListGroup >
132+ ) ;
133+ assert . equal ( React . findDOMNode ( instance ) . nodeName , 'DIV' ) ;
134+ assert . equal ( React . findDOMNode ( instance ) . firstChild . nodeName , 'A' ) ;
135+ assert . equal ( React . findDOMNode ( instance ) . lastChild . nodeName , 'SPAN' ) ;
136+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'list-group' ) ) ;
137+ } ) ;
138+
123139} ) ;
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ import lib from './lib/build';
66import docs from '../docs/build' ;
77import dist from './dist/build' ;
88import { copy } from './fs-utils' ;
9- import { setExecOptions } from './exec' ;
109import { distRoot , bowerRoot } from './constants' ;
10+ import { exec , setExecOptions } from './exec' ;
1111
1212import yargs from 'yargs' ;
1313
@@ -33,7 +33,7 @@ export default function Build(noExitOnFailure) {
3333 lib ( ) ,
3434 bower ( ) ,
3535 dist ( ) ,
36- docs ( )
36+ exec ( `npm run docs-build` )
3737 ] )
3838 . then ( ( ) => copy ( distRoot , bowerRoot ) ) ;
3939
You can’t perform that action at this time.
0 commit comments