This repository was archived by the owner on May 13, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,11 +2,21 @@ import React from 'react';
22import classNames from 'classnames' ;
33
44const Jumbotron = React . createClass ( {
5+ propTypes : {
6+ componentClass : React . PropTypes . any . isRequired
7+ } ,
8+
9+ getDefaultProps ( ) {
10+ return { componentClass : 'div' } ;
11+ } ,
12+
513 render ( ) {
14+ const ComponentClass = this . props . componentClass ;
15+
616 return (
7- < div { ...this . props } className = { classNames ( this . props . className , 'jumbotron' ) } >
17+ < ComponentClass { ...this . props } className = { classNames ( this . props . className , 'jumbotron' ) } >
818 { this . props . children }
9- </ div >
19+ </ ComponentClass >
1020 ) ;
1121 }
1222} ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ describe('Jumbotron', function () {
99 < strong > Content</ strong >
1010 </ Jumbotron >
1111 ) ;
12+
13+ assert . equal ( React . findDOMNode ( instance ) . nodeName , 'DIV' ) ;
1214 assert . ok ( ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'strong' ) ) ;
1315 } ) ;
1416
@@ -20,4 +22,13 @@ describe('Jumbotron', function () {
2022 ) ;
2123 assert . ok ( React . findDOMNode ( instance ) . className . match ( / \b j u m b o t r o n \b / ) ) ;
2224 } ) ;
25+
26+ it ( 'Should override node class' , function ( ) {
27+ let instance = ReactTestUtils . renderIntoDocument (
28+ < Jumbotron componentClass = 'section' >
29+ < strong > Content</ strong >
30+ </ Jumbotron >
31+ ) ;
32+ assert . equal ( React . findDOMNode ( instance ) . nodeName , 'SECTION' ) ;
33+ } ) ;
2334} ) ;
You can’t perform that action at this time.
0 commit comments