diff --git a/src/Panel.js b/src/Panel.js index 067207d670..4f2ea19a1c 100644 --- a/src/Panel.js +++ b/src/Panel.js @@ -156,17 +156,19 @@ const Panel = React.createClass({ if (!React.isValidElement(header) || Array.isArray(header)) { header = collapsible ? this.renderCollapsableTitle(header) : header; - } else if (collapsible) { - - header = cloneElement(header, { - className: classNames(this.prefixClass('title')), - children: this.renderAnchor(header.props.children) - }); } else { + const className = classNames( + this.prefixClass('title'), header.props.className + ); - header = cloneElement(header, { - className: classNames(this.prefixClass('title')) - }); + if (collapsible) { + header = cloneElement(header, { + className, + children: this.renderAnchor(header.props.children) + }); + } else { + header = cloneElement(header, {className}); + } } return ( diff --git a/test/PanelSpec.js b/test/PanelSpec.js index 0817679fc6..7f5416c046 100644 --- a/test/PanelSpec.js +++ b/test/PanelSpec.js @@ -58,6 +58,18 @@ describe('Panel', function () { assert.equal(header.firstChild.firstChild.innerHTML, 'Heading'); }); + it('Should have custom component header with custom class', function () { + let header =