Fix responsive DataGrid contraction
This commit is contained in:
@@ -219,6 +219,52 @@ assertWidths(
|
||||
"committing a cover resize preserves intentional overflow without a mouse-up snap"
|
||||
);
|
||||
|
||||
const contractedUserLayout = fitDataGridColumns(
|
||||
resizeColumns,
|
||||
700,
|
||||
{},
|
||||
resizedLast.widths,
|
||||
"cover",
|
||||
900
|
||||
);
|
||||
assertEqual(
|
||||
contractedUserLayout.overflowWidth,
|
||||
120,
|
||||
"container contraction retains only the overflow deliberately selected by the user"
|
||||
);
|
||||
assertEqual(
|
||||
Object.values(contractedUserLayout.widths).reduce((total, width) => total + width, 0),
|
||||
820,
|
||||
"persisted tracks contract with their container instead of retaining the first pixel layout"
|
||||
);
|
||||
assertEqual(
|
||||
Object.entries(contractedUserLayout.widths).every(([columnId, width]) => {
|
||||
const column = resizeColumns.find((candidate) => candidate.id === columnId);
|
||||
return Boolean(column && width >= effectiveDataGridColumnMinWidth(column));
|
||||
}),
|
||||
true,
|
||||
"responsive user layouts retain every hard column minimum"
|
||||
);
|
||||
|
||||
const contractedCoveredLayout = fitDataGridColumns(
|
||||
resizeColumns,
|
||||
700,
|
||||
{},
|
||||
resizeBase,
|
||||
"cover",
|
||||
900
|
||||
);
|
||||
assertEqual(
|
||||
contractedCoveredLayout.overflowWidth,
|
||||
0,
|
||||
"an exact-cover user layout continues to cover a narrower container without avoidable overflow"
|
||||
);
|
||||
assertEqual(
|
||||
Object.values(contractedCoveredLayout.widths).reduce((total, width) => total + width, 0),
|
||||
700,
|
||||
"an exact-cover layout shrinks to the newly available width"
|
||||
);
|
||||
|
||||
const stoppedLastShrink = resizeDataGridColumn(
|
||||
resizeColumns,
|
||||
resizeBase,
|
||||
@@ -361,3 +407,8 @@ assertEqual(
|
||||
false,
|
||||
"free and cover layouts keep independent user overrides"
|
||||
);
|
||||
assertEqual(
|
||||
originalSignature.startsWith("v2::"),
|
||||
true,
|
||||
"the responsive persistence contract invalidates legacy hard-width snapshots"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user