Skip to content

Commit 910668f

Browse files
committed
Merge pull request react-bootstrap#517 from thehuey/tabbedarea-className
[added] TabbedArea NavItem renderTab() className [fixes] react-bootstrap#516
2 parents c8fad2a + 1d8b7c7 commit 910668f

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

src/TabbedArea.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ const TabbedArea = React.createClass({
105105
},
106106

107107
renderTab(child) {
108-
let key = child.props.eventKey;
108+
let {eventKey, className, tab } = child.props;
109109
return (
110110
<NavItem
111-
ref={'tab' + key}
112-
eventKey={key}>
113-
{child.props.tab}
111+
ref={'tab' + eventKey}
112+
eventKey={eventKey}
113+
className={className} >
114+
{tab}
114115
</NavItem>
115116
);
116117
},

test/TabbedAreaSpec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,20 @@ describe('TabbedArea', function () {
182182

183183
assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'nav-pills'));
184184
});
185+
186+
it('Should pass className to rendered Tab NavItem', function () {
187+
let instance = ReactTestUtils.renderIntoDocument(
188+
<TabbedArea activeKey={3}>
189+
<TabPane tab="Tab 1" eventKey={1}>Tab 1 content</TabPane>
190+
<TabPane className="pull-right" tab="Tab 2" eventKey={3}>Tab 3 content</TabPane>
191+
</TabbedArea>
192+
);
193+
194+
let tabPane = ReactTestUtils.scryRenderedComponentsWithType(instance, TabPane);
195+
196+
assert.equal(tabPane.length, 2);
197+
assert.equal(tabPane[1].getDOMNode().getAttribute('class').match(/pull-right/)[0], 'pull-right');
198+
});
199+
200+
185201
});

0 commit comments

Comments
 (0)