File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed
Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,9 @@ class Overlay extends React.Component {
7878 </ Transition >
7979 ) ;
8080 } else {
81- child = cloneElement (
82- child ,
83- { className : classNames ( 'in' , child . className ) }
84- ) ;
81+ child = cloneElement ( child , {
82+ className : classNames ( 'in' , child . props . className )
83+ } ) ;
8584 }
8685
8786 // This goes after everything else because it adds a wrapping div.
Original file line number Diff line number Diff line change 11import React , { cloneElement } from 'react' ;
2+ import classNames from 'classnames' ;
23import domUtils from './utils/domUtils' ;
34import { calcOverlayPosition } from './utils/overlayPositionUtils' ;
45import CustomPropTypes from './utils/CustomPropTypes' ;
@@ -40,7 +41,7 @@ class Position extends React.Component {
4041 }
4142
4243 render ( ) {
43- const { children, ...props } = this . props ;
44+ const { children, className , ...props } = this . props ;
4445 const { positionLeft, positionTop, ...arrowPosition } = this . state ;
4546
4647 const child = React . Children . only ( children ) ;
@@ -51,6 +52,7 @@ class Position extends React.Component {
5152 ...arrowPosition ,
5253 positionTop,
5354 positionLeft,
55+ className : classNames ( className , child . props . className ) ,
5456 style : {
5557 ...child . props . style ,
5658 left : positionLeft ,
Original file line number Diff line number Diff line change @@ -39,6 +39,19 @@ describe('OverlayTrigger', function() {
3939 instance . state . isOverlayShown . should . be . true ;
4040 } ) ;
4141
42+ it ( 'Should maintain overlay classname' , function ( ) {
43+ const instance = ReactTestUtils . renderIntoDocument (
44+ < OverlayTrigger trigger = 'click' overlay = { < div className = 'test-overlay' > test</ div > } >
45+ < button > button</ button >
46+ </ OverlayTrigger >
47+ ) ;
48+
49+ const overlayTrigger = React . findDOMNode ( instance ) ;
50+ ReactTestUtils . Simulate . click ( overlayTrigger ) ;
51+
52+ expect ( document . getElementsByClassName ( 'test-overlay' ) . length ) . to . equal ( 1 )
53+ } ) ;
54+
4255 it ( 'Should pass transition callbacks to Transition' , function ( done ) {
4356 let count = 0 ;
4457 let increment = ( ) => count ++ ;
You can’t perform that action at this time.
0 commit comments