@@ -1366,37 +1366,56 @@ describe('UnifiedDataTable', () => {
13661366 EXTENDED_JEST_TIMEOUT
13671367 ) ;
13681368
1369- it (
1370- 'should show the reset width button only for absolute width columns, and allow resetting to default width' ,
1371- async ( ) => {
1372- await renderDataTable ( {
1373- columns : [ 'message' , 'extension' ] ,
1374- settings : {
1375- columns : {
1376- '@timestamp' : { width : 50 } ,
1377- extension : { width : 50 } ,
1369+ describe ( 'given a column with absolute width' , ( ) => {
1370+ describe ( 'when it is the time column' , ( ) => {
1371+ it ( 'should use default time column width when resetting' , async ( ) => {
1372+ await renderDataTable ( {
1373+ columns : [ ] ,
1374+ settings : {
1375+ columns : {
1376+ '@timestamp' : { width : 50 } ,
1377+ } ,
13781378 } ,
1379- } ,
1379+ } ) ;
1380+
1381+ expect ( getColumnHeader ( '@timestamp' ) ) . toHaveStyle ( { width : '50px' } ) ;
1382+ await openColumnActions ( '@timestamp' ) ;
1383+ await userEvent . click ( screen . getByTestId ( 'unifiedDataTableResetColumnWidth' ) ) ;
1384+ expect ( getColumnHeader ( '@timestamp' ) ) . toHaveStyle ( {
1385+ width : `${ defaultTimeColumnWidth } px` ,
1386+ } ) ;
13801387 } ) ;
1381- expect ( getColumnHeader ( '@timestamp' ) ) . toHaveStyle ( { width : '50px' } ) ;
1388+ } ) ;
13821389
1383- await openColumnActions ( '@timestamp' ) ;
1384- await userEvent . click ( screen . getByTestId ( 'unifiedDataTableResetColumnWidth' ) ) ;
1385- expect ( getColumnHeader ( '@timestamp' ) ) . toHaveStyle ( {
1386- width : `${ defaultTimeColumnWidth } px` ,
1390+ describe ( 'when it is not the time column' , ( ) => {
1391+ it ( 'should use EUI default column width when resetting' , async ( ) => {
1392+ await renderDataTable ( {
1393+ columns : [ 'extension' ] ,
1394+ settings : {
1395+ columns : {
1396+ extension : { width : 50 } ,
1397+ } ,
1398+ } ,
1399+ } ) ;
1400+
1401+ expect ( getColumnHeader ( 'extension' ) ) . toHaveStyle ( { width : '50px' } ) ;
1402+ await openColumnActions ( 'extension' ) ;
1403+ await userEvent . click ( screen . getByTestId ( 'unifiedDataTableResetColumnWidth' ) ) ;
1404+ expect ( getColumnHeader ( 'extension' ) ) . toHaveStyle ( {
1405+ width : EUI_DEFAULT_COLUMN_WIDTH ,
1406+ } ) ;
13871407 } ) ;
1408+ } ) ;
1409+ } ) ;
13881410
1411+ describe ( 'given a column without absolute width' , ( ) => {
1412+ it ( 'should not show the reset width button' , async ( ) => {
1413+ await renderDataTable ( { columns : [ 'message' ] } ) ;
13891414 expect ( getColumnHeader ( 'message' ) ) . toHaveStyle ( { width : EUI_DEFAULT_COLUMN_WIDTH } ) ;
13901415 await openColumnActions ( 'message' ) ;
13911416 expect ( screen . queryByTestId ( 'unifiedDataTableResetColumnWidth' ) ) . not . toBeInTheDocument ( ) ;
1392-
1393- expect ( getColumnHeader ( 'extension' ) ) . toHaveStyle ( { width : '50px' } ) ;
1394- await openColumnActions ( 'extension' ) ;
1395- await userEvent . click ( screen . getByTestId ( 'unifiedDataTableResetColumnWidth' ) ) ;
1396- expect ( getColumnHeader ( 'extension' ) ) . toHaveStyle ( { width : EUI_DEFAULT_COLUMN_WIDTH } ) ;
1397- } ,
1398- EXTENDED_JEST_TIMEOUT
1399- ) ;
1417+ } ) ;
1418+ } ) ;
14001419
14011420 it (
14021421 'should have columnVisibility configuration' ,
0 commit comments