Skip to content

Commit d4afa2b

Browse files
committed
Test
1 parent 51c2bdd commit d4afa2b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/hooks/useColumnWidths.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export function useColumnWidths<R, SR>(
8686
const { key: resizingKey } = column;
8787
const columnsToMeasure: string[] = [];
8888

89+
// remeasure all columns that can flex and are not resized by the user
8990
for (const { key, width } of viewportColumns) {
9091
if (
9192
resizingKey !== key &&

test/browser/column/resizable.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,23 @@ test('should use the minWidth if specified', async () => {
9494
});
9595

9696
test('should auto resize column when resize handle is double clicked', async () => {
97+
const onColumnResize = vi.fn();
9798
setup<Row, unknown>({
9899
columns,
99100
rows: [
100101
{
101102
col1: 1,
102103
col2: 'a'.repeat(50)
103104
}
104-
]
105+
],
106+
onColumnResize
105107
});
106108
const [, col2] = getHeaderCells();
107109
const grid = getGrid();
108110
await expect.element(grid).toHaveStyle({ gridTemplateColumns: '100px 200px' });
109111
await autoResize(col2);
110112
await expect.element(grid).toHaveStyle({ gridTemplateColumns: '100px 327.703px' });
113+
expect(onColumnResize).toHaveBeenCalledExactlyOnceWith(expect.objectContaining(col2), 327.703);
111114
});
112115

113116
test('should use the maxWidth if specified on auto resize', async () => {

0 commit comments

Comments
 (0)