@@ -143,6 +143,10 @@ test('should respect minWidth when dynamically adding columns via visibleColumns
143143 { id : 'small-width' , header : '' , cell : ( ) => '-' , width : 80 , minWidth : 150 } ,
144144 { id : 'width-only' , header : '' , cell : ( ) => '-' , width : 180 } ,
145145 { id : 'minWidth-larger' , header : '' , cell : ( ) => '-' , width : 180 , minWidth : 200 } ,
146+ { id : 'no-width-no-minWidth' , header : '' , cell : ( ) => '-' } ,
147+ { id : 'no-width-minWidth-large' , header : '' , cell : ( ) => '-' , minWidth : 200 } ,
148+ { id : 'no-width-minWidth-small' , header : '' , cell : ( ) => '-' , minWidth : 80 } ,
149+ { id : 'width-larger-than-minWidth' , header : '' , cell : ( ) => '-' , width : 200 , minWidth : 100 } ,
146150 ] ;
147151 const { wrapper, rerender } = renderTable (
148152 < Table columnDefinitions = { columns } visibleColumns = { [ 'id' ] } items = { defaultItems } resizableColumns = { true } />
@@ -153,17 +157,30 @@ test('should respect minWidth when dynamically adding columns via visibleColumns
153157 rerender (
154158 < Table
155159 columnDefinitions = { columns }
156- visibleColumns = { [ 'id' , 'small-width' , 'width-only' , 'minWidth-larger' ] }
160+ visibleColumns = { [
161+ 'id' ,
162+ 'small-width' ,
163+ 'width-only' ,
164+ 'minWidth-larger' ,
165+ 'no-width-no-minWidth' ,
166+ 'no-width-minWidth-large' ,
167+ 'no-width-minWidth-small' ,
168+ 'width-larger-than-minWidth' ,
169+ ] }
157170 items = { defaultItems }
158171 resizableColumns = { true }
159172 />
160173 ) ;
161174
162175 expect ( wrapper . findColumnHeaders ( ) . map ( column => column . getElement ( ) . style . width ) ) . toEqual ( [
163176 '100px' , // original column unchanged
164- '150px' , // use minWidth because 150 > 80
165- '180px' , // use width (minWidth defaults to width)
166- '200px' , // use minWidth because 200 > 180
177+ '150px' , // width=80, minWidth=150 -> use minWidth because 150 > 80
178+ '180px' , // width=180, no minWidth -> minWidth defaults to width, use 180
179+ '200px' , // width=180, minWidth=200 -> use minWidth because 200 > 180
180+ '120px' , // no width, no minWidth -> width defaults to DEFAULT (120), minWidth defaults to width
181+ '200px' , // no width, minWidth=200 -> width defaults to DEFAULT (120), minWidth=200 -> use 200
182+ '120px' , // no width, minWidth=80 -> width defaults to DEFAULT (120), minWidth=80 -> use 120
183+ '200px' , // width=200, minWidth=100 -> use width because 200 > 100
167184 ] ) ;
168185} ) ;
169186
0 commit comments