@@ -54,17 +54,14 @@ test('should resize column when dragging the handle', async () => {
5454 expect ( onColumnResize ) . not . toHaveBeenCalled ( ) ;
5555 await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 200px' } ) ;
5656 await resize ( 'col2' , - 50 ) ;
57- await testGridTemplateColumns ( '100px 150px' , '100px 150.5px' ) ;
58- expect ( onColumnResize ) . toHaveBeenCalledExactlyOnceWith (
59- expect . objectContaining ( columns [ 1 ] ) ,
60- satisfyRange ( 150 )
61- ) ;
57+ await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 150px' } ) ;
58+ expect ( onColumnResize ) . toHaveBeenCalledExactlyOnceWith ( expect . objectContaining ( columns [ 1 ] ) , 150 ) ;
6259} ) ;
6360
6461test ( 'should use the maxWidth if specified when dragging the handle' , async ( ) => {
6562 await setup < Row , unknown > ( { columns, rows : [ ] } ) ;
6663 const grid = getGrid ( ) ;
67- await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 200px ' } ) ;
64+ await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 200px' } ) ;
6865 await resize ( 'col2' , 1000 ) ;
6966 await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 400px' } ) ;
7067} ) ;
@@ -100,7 +97,7 @@ test('should use the maxWidth if specified when resizing using keyboard', async
10097 const onColumnResize = vi . fn ( ) ;
10198 await setup < Row , unknown > ( { columns, rows : [ ] , onColumnResize } ) ;
10299 const grid = getGrid ( ) ;
103- await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 200px ' } ) ;
100+ await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '100px 200px' } ) ;
104101 const col2 = getHeaderCell ( 'col2' ) ;
105102 await userEvent . click ( col2 ) ;
106103 await userEvent . keyboard ( `{Control>}${ '{ArrowRight}' . repeat ( 22 ) } {/Control}` ) ;
@@ -305,16 +302,8 @@ test('should use columnWidths and onColumnWidthsChange props when provided', asy
305302 ] )
306303 ) ;
307304 expect ( onColumnResizeSpy ) . toHaveBeenCalledTimes ( 3 ) ;
308- expect ( onColumnResizeSpy ) . toHaveBeenNthCalledWith (
309- 1 ,
310- expect . objectContaining ( columns [ 1 ] ) ,
311- satisfyRange ( 105 )
312- ) ;
313- expect ( onColumnResizeSpy ) . toHaveBeenNthCalledWith (
314- 2 ,
315- expect . objectContaining ( columns [ 1 ] ) ,
316- satisfyRange ( 110 )
317- ) ;
305+ expect ( onColumnResizeSpy ) . toHaveBeenNthCalledWith ( 1 , expect . objectContaining ( columns [ 1 ] ) , 105 ) ;
306+ expect ( onColumnResizeSpy ) . toHaveBeenNthCalledWith ( 2 , expect . objectContaining ( columns [ 1 ] ) , 110 ) ;
318307 expect ( onColumnResizeSpy ) . toHaveBeenNthCalledWith ( 3 , expect . objectContaining ( columns [ 1 ] ) , 115 ) ;
319308 onColumnWidthsChangeSpy . mockClear ( ) ;
320309 onColumnResizeSpy . mockClear ( ) ;
@@ -324,11 +313,10 @@ test('should use columnWidths and onColumnWidthsChange props when provided', asy
324313 expect ( onColumnResizeSpy ) . not . toHaveBeenCalled ( ) ;
325314 await expect . element ( grid ) . toHaveStyle ( { gridTemplateColumns : '120px 120px' } ) ;
326315 await resize ( 'col2' , [ 5 , 5 ] ) ;
327- const col2Width = navigator . userAgent . includes ( 'Chrome' ) ? 130 : 130.5 ;
328316 expect ( onColumnWidthsChangeSpy ) . toHaveBeenCalledExactlyOnceWith (
329317 new Map ( [
330318 [ 'col1' , { width : 120 , type : 'measured' } ] ,
331- [ 'col2' , { width : col2Width , type : 'resized' } ]
319+ [ 'col2' , { width : 130 , type : 'resized' } ]
332320 ] )
333321 ) ;
334322} ) ;
@@ -346,9 +334,3 @@ async function testGridTemplateColumns(chrome: string, firefox: string, firefoxC
346334 } ) ;
347335 }
348336}
349-
350- // TODO: remove once scale is set to 1
351- function satisfyRange ( value : number ) {
352- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
353- return expect . toSatisfy ( ( v : number ) => v >= value - 1 && v <= value + 1 ) ;
354- }
0 commit comments