Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tab] Add labelClassName property #6436

Merged
merged 1 commit into from
Mar 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Tabs/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export default class Tab extends Component {
* The label element.
*/
label: PropTypes.node,
/**
* The CSS class name of the label element.
*/
labelClassName: PropTypes.string,
/**
* @ignore
*/
Expand Down Expand Up @@ -140,6 +144,7 @@ export default class Tab extends Component {
icon: iconProp,
index, // eslint-disable-line no-unused-vars
label: labelProp,
labelClassName,
onChange, // eslint-disable-line no-unused-vars
selected,
style: styleProp,
Expand All @@ -162,7 +167,7 @@ export default class Tab extends Component {

if (labelProp !== undefined) {
label = (
<span className={classes.label}>
<span className={classNames(classes.label, labelClassName)}>
{labelProp}
</span>
);
Expand Down
9 changes: 9 additions & 0 deletions src/Tabs/Tab.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ describe('<Tab />', () => {
});
});

describe('prop: labelClassName', () => {
it('should render label with a custom label class', () => {
const wrapper = shallow(<Tab label="foo" labelClassName="MyLabel" />);
const label = wrapper.childAt(0);
assert.strictEqual(label.hasClass(classes.label), true);
assert.strictEqual(label.hasClass('MyLabel'), true);
});
});

describe('prop: icon', () => {
it('should render icon element', () => {
const wrapper = shallow(<Tab icon={icon} />);
Expand Down