From dbb03858d01ab46d7ac19a20760acf3c69365455 Mon Sep 17 00:00:00 2001 From: Ed Gauci Date: Tue, 29 Sep 2015 12:19:42 -0700 Subject: [PATCH] [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'); });