Skip to content

Commit

Permalink
[added] Added buttonClassName to DropdownButton
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiago Aguiar authored and Santiago Aguiar committed Apr 29, 2015
1 parent 2e8a8bc commit 3767c43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DropdownButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const DropdownButton = React.createClass({
onClick: React.PropTypes.func,
onSelect: React.PropTypes.func,
navItem: React.PropTypes.bool,
noCaret: React.PropTypes.bool
noCaret: React.PropTypes.bool,
buttonClassName: React.PropTypes.string
},

render() {
Expand All @@ -34,7 +35,7 @@ const DropdownButton = React.createClass({
<Button
{...this.props}
ref="dropdownButton"
className="dropdown-toggle"
className={classNames('dropdown-toggle', this.props.buttonClassName)}
onClick={this.handleDropdownClick}
key={0}
navDropdown={this.props.navItem}
Expand Down
12 changes: 12 additions & 0 deletions test/DropdownButtonSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,16 @@ describe('DropdownButton', function () {
let carets = button.getElementsByClassName('caret');
assert.equal(carets.length, 0);
});

it('should set button class when buttonClassName is given', function() {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton buttonClassName="test-class">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);

let button = ReactTestUtils.findRenderedComponentWithType(instance, Button).getDOMNode();
assert.ok(button.className.match(/\btest-class\b/));
});
});

0 comments on commit 3767c43

Please sign in to comment.