Skip to content

Commit 67ce81d

Browse files
committed
Merge remote-tracking branch 'origin/master' into pr576
Conflicts: tools/build.js
2 parents ac890b5 + 073d80f commit 67ce81d

6 files changed

Lines changed: 31 additions & 13 deletions

File tree

src/ListGroup.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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 })

src/ListGroupItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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);

src/TabbedArea.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff 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
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import 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

88
describe('CollapsableNav', function () {
99
it('Should create div and add collapse class', function () {

test/ListGroupSpec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

tools/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import lib from './lib/build';
66
import docs from '../docs/build';
77
import dist from './dist/build';
88
import { copy } from './fs-utils';
9-
import { setExecOptions } from './exec';
109
import { distRoot, bowerRoot } from './constants';
10+
import { exec, setExecOptions } from './exec';
1111

1212
import 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

0 commit comments

Comments
 (0)