File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 conditionallyUpdateScrollbar ,
1010 setScrollbarWidth ,
1111 mapToCssModules ,
12+ omit
1213} from './utils' ;
1314
1415const propTypes = {
@@ -45,6 +46,8 @@ const propTypes = {
4546 modalTransitionLeaveTimeout : PropTypes . number ,
4647} ;
4748
49+ const propsToOmit = Object . keys ( propTypes ) ;
50+
4851const defaultProps = {
4952 isOpen : false ,
5053 autoFocus : true ,
@@ -182,13 +185,16 @@ class Modal extends React.Component {
182185 }
183186
184187 renderModalDialog ( ) {
188+ const attributes = omit ( this . props , propsToOmit ) ;
189+
185190 return (
186191 < div
187192 className = { mapToCssModules ( classNames ( 'modal-dialog' , this . props . className , {
188193 [ `modal-${ this . props . size } ` ] : this . props . size
189194 } ) , this . props . cssModule ) }
190195 role = "document"
191196 ref = { ( c ) => ( this . _dialog = c ) }
197+ { ...attributes }
192198 >
193199 < div
194200 className = { mapToCssModules (
Original file line number Diff line number Diff line change @@ -97,6 +97,21 @@ describe('Modal', () => {
9797 wrapper . unmount ( ) ;
9898 } ) ;
9999
100+ it ( 'should render with additional props if provided' , ( ) => {
101+ isOpen = true ;
102+ const wrapper = mount (
103+ < Modal isOpen = { isOpen } toggle = { toggle } style = { { maxWidth : '95%' } } >
104+ Yo!
105+ </ Modal >
106+ ) ;
107+
108+ jasmine . clock ( ) . tick ( 300 ) ;
109+ expect ( wrapper . children ( ) . length ) . toBe ( 0 ) ;
110+ expect ( document . getElementsByClassName ( 'modal-dialog' ) . length ) . toBe ( 1 ) ;
111+ expect ( document . getElementsByClassName ( 'modal-dialog' ) [ 0 ] . style . maxWidth ) . toBe ( '95%' ) ;
112+ wrapper . unmount ( ) ;
113+ } ) ;
114+
100115 it ( 'should render without fade transition if provided with fade={false}' , ( ) => {
101116 isOpen = true ;
102117 const wrapper = mount (
You can’t perform that action at this time.
0 commit comments