From dbb03858d01ab46d7ac19a20760acf3c69365455 Mon Sep 17 00:00:00 2001 From: Ed Gauci Date: Tue, 29 Sep 2015 12:19:42 -0700 Subject: [PATCH 1/2] [added] #1320 allow NavItem class to be set --- src/Tabs.js | 6 ++++-- test/TabsSpec.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Tabs.js b/src/Tabs.js index 028d223aa1..de56b36eb9 100644 --- a/src/Tabs.js +++ b/src/Tabs.js @@ -88,6 +88,7 @@ const Tabs = React.createClass({ React.PropTypes.number, React.PropTypes.object ]), + className: React.PropTypes.string, /** * Render without clearfix if horizontally positioned */ @@ -271,7 +272,7 @@ const Tabs = React.createClass({ return null; } - let { eventKey, title, disabled, onKeyDown, tabIndex = 0 } = child.props; + let { eventKey, title, disabled, onKeyDown, tabClassName, tabIndex = 0 } = child.props; let isActive = this.getActiveKey() === eventKey; return ( @@ -282,7 +283,8 @@ const Tabs = React.createClass({ onKeyDown={createChainedFunction(this.handleKeyDown, onKeyDown)} eventKey={eventKey} tabIndex={isActive ? tabIndex : -1} - disabled={disabled }> + disabled={disabled } + className={tabClassName}> {title} ); diff --git a/test/TabsSpec.js b/test/TabsSpec.js index e247bb3875..451385691f 100644 --- a/test/TabsSpec.js +++ b/test/TabsSpec.js @@ -84,13 +84,15 @@ describe('Tabs', () => { let instance = ReactTestUtils.renderIntoDocument( Tab 1 content - Tab 2 content + Tab 2 content ); let panes = ReactTestUtils.scryRenderedComponentsWithType(instance, Tab); + let navs = ReactTestUtils.scryRenderedComponentsWithType(instance, NavItem); assert.ok(React.findDOMNode(panes[0]).className.match(/\bcustom\b/)); + assert.ok(React.findDOMNode(navs[1]).className.match(/\btcustom\b/)); assert.equal(React.findDOMNode(panes[0]).id, 'pane0id'); }); From 1e54893ae38104e692b63fa210e6446e23aa5ebe Mon Sep 17 00:00:00 2001 From: Ed Gauci Date: Thu, 1 Oct 2015 14:47:53 -0700 Subject: [PATCH 2/2] Revisions based on feedback --- src/Tab.js | 6 +++++- src/Tabs.js | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Tab.js b/src/Tab.js index 100e2a16cd..e29124c1be 100644 --- a/src/Tab.js +++ b/src/Tab.js @@ -15,7 +15,11 @@ const Tab = React.createClass({ */ onAnimateOutEnd: React.PropTypes.func, disabled: React.PropTypes.bool, - title: React.PropTypes.node + title: React.PropTypes.node, + /** + * tabClassName is used as className for the associated NavItem + */ + tabClassName: React.PropTypes.string }, getDefaultProps() { diff --git a/src/Tabs.js b/src/Tabs.js index de56b36eb9..2b96aaa279 100644 --- a/src/Tabs.js +++ b/src/Tabs.js @@ -88,7 +88,6 @@ const Tabs = React.createClass({ React.PropTypes.number, React.PropTypes.object ]), - className: React.PropTypes.string, /** * Render without clearfix if horizontally positioned */