Table: fix use row height after lines-to-pxs update (#109943)

This commit is contained in:
Paul Marbach
2025-08-21 14:02:06 -04:00
committed by GitHub
parent c4460dc568
commit 65317ffcbd
2 changed files with 12 additions and 4 deletions
@@ -477,7 +477,7 @@ describe('TableNG hooks', () => {
}),
columnWidths: [100, 100, 100],
enabled: true,
typographyCtx: { ...typographyCtx, avgCharWidth: 5, measureHeight: jest.fn(() => 38) },
typographyCtx: { ...typographyCtx, avgCharWidth: 5, measureHeight: jest.fn(() => 44) },
sortColumns: [],
});
});
@@ -518,7 +518,7 @@ describe('TableNG hooks', () => {
});
});
expect(heightFn).toHaveBeenCalledWith('Longer name that needs wrapping', 86, modifiedFields[0], -1, 6);
expect(heightFn).toHaveBeenCalledWith('Longer name that needs wrapping', 86, modifiedFields[0], -1, 22);
modifiedFields = fields.map((field) => {
if (field.name === 'name') {
@@ -549,7 +549,7 @@ describe('TableNG hooks', () => {
});
});
expect(heightFn).toHaveBeenCalledWith('Longer name that needs wrapping', 26, modifiedFields[0], -1, 6);
expect(heightFn).toHaveBeenCalledWith('Longer name that needs wrapping', 26, modifiedFields[0], -1, 22);
});
});
@@ -368,7 +368,15 @@ export function useHeaderHeight({
if (!enabled) {
return 0;
}
return getRowHeight(fields, -1, columnAvailableWidths, TABLE.HEADER_HEIGHT, measurers, TABLE.CELL_PADDING);
return getRowHeight(
fields,
-1,
columnAvailableWidths,
TABLE.HEADER_HEIGHT,
measurers,
TABLE.LINE_HEIGHT,
TABLE.CELL_PADDING
);
}, [fields, enabled, columnAvailableWidths, measurers]);
return headerHeight;