mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 00:09:52 +00:00
feat(grid): link cell detail to selection
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
canFormatCellDetailJson,
|
||||
cellDetailEditorText,
|
||||
defaultCellDetailTab,
|
||||
linkedCellDetailTarget,
|
||||
visibleCellDetailTabs,
|
||||
valueEditorActions,
|
||||
type CellDetailPresentationOptions,
|
||||
@@ -54,3 +55,24 @@ test("cell detail value editor uses cell actions instead of confirm and cancel",
|
||||
]);
|
||||
assert.deepEqual(valueEditorActions({ canSetNull: false }), ["restoreOriginal"]);
|
||||
});
|
||||
|
||||
test("cell detail follows the selected grid cell while open", () => {
|
||||
assert.deepEqual(
|
||||
linkedCellDetailTarget({
|
||||
isOpen: true,
|
||||
isEditing: false,
|
||||
selectedCell: { rowIndex: 2, visibleColIndex: 1 },
|
||||
actualColumnIndex: (visibleColIndex) => [0, 3, 5][visibleColIndex] ?? visibleColIndex,
|
||||
}),
|
||||
{ rowIndex: 2, col: 3 },
|
||||
);
|
||||
});
|
||||
|
||||
test("cell detail does not follow selection while closed or editing", () => {
|
||||
const selectedCell = { rowIndex: 2, visibleColIndex: 1 };
|
||||
const actualColumnIndex = (visibleColIndex: number) => visibleColIndex;
|
||||
|
||||
assert.equal(linkedCellDetailTarget({ isOpen: false, isEditing: false, selectedCell, actualColumnIndex }), null);
|
||||
assert.equal(linkedCellDetailTarget({ isOpen: true, isEditing: true, selectedCell, actualColumnIndex }), null);
|
||||
assert.equal(linkedCellDetailTarget({ isOpen: true, isEditing: false, selectedCell: null, actualColumnIndex }), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user