diff --git a/src/Jumbotron.js b/src/Jumbotron.js index 41af93dd0a..2aacb10dfe 100644 --- a/src/Jumbotron.js +++ b/src/Jumbotron.js @@ -2,11 +2,21 @@ import React from 'react'; import classNames from 'classnames'; const Jumbotron = React.createClass({ + propTypes: { + componentClass: React.PropTypes.any.isRequired + }, + + getDefaultProps() { + return { componentClass: 'div' }; + }, + render() { + const ComponentClass = this.props.componentClass; + return ( -
+ {this.props.children} -
+ ); } }); diff --git a/test/JumbotronSpec.js b/test/JumbotronSpec.js index b0749c1939..460b43153f 100644 --- a/test/JumbotronSpec.js +++ b/test/JumbotronSpec.js @@ -9,6 +9,8 @@ describe('Jumbotron', function () { Content ); + + assert.equal(React.findDOMNode(instance).nodeName, 'DIV'); assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong')); }); @@ -20,4 +22,13 @@ describe('Jumbotron', function () { ); assert.ok(React.findDOMNode(instance).className.match(/\bjumbotron\b/)); }); + + it('Should override node class', function () { + let instance = ReactTestUtils.renderIntoDocument( + + Content + + ); + assert.equal(React.findDOMNode(instance).nodeName, 'SECTION'); + }); });