mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-14 02:24:19 +08:00
@@ -1073,7 +1073,7 @@ describe('DataGrid DDL interactions', () => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it('selects one row when its row number cell is clicked', async () => {
|
||||
it('toggles one row when its row number cell is clicked', async () => {
|
||||
storeState.appearance.uiVersion = 'v2';
|
||||
const rows = [
|
||||
{ [GONAVI_ROW_KEY]: 'row-1', id: 1 },
|
||||
@@ -1107,6 +1107,14 @@ describe('DataGrid DDL interactions', () => {
|
||||
expect(stopPropagation).toHaveBeenCalledTimes(1);
|
||||
expect(testRenderState.latestTableProps.rowHoverable).toBe(false);
|
||||
expect(testRenderState.latestTableProps.rowSelection.selectedRowKeys).toEqual(['row-2']);
|
||||
|
||||
await act(async () => {
|
||||
rowNumberColumn.onCell(rows[1], 1).onClick({ stopPropagation });
|
||||
});
|
||||
await waitForEffects();
|
||||
|
||||
expect(stopPropagation).toHaveBeenCalledTimes(2);
|
||||
expect(testRenderState.latestTableProps.rowSelection.selectedRowKeys).toEqual([]);
|
||||
renderer!.unmount();
|
||||
});
|
||||
|
||||
|
||||
@@ -3381,7 +3381,9 @@ const DataGrid: React.FC<DataGridProps> = ({
|
||||
const handleRowNumberClick = useCallback((record: Item) => {
|
||||
const key = record?.[GONAVI_ROW_KEY];
|
||||
if (key === undefined || key === null) return;
|
||||
setSelectedRowKeys([key]);
|
||||
setSelectedRowKeys((previousKeys) => (
|
||||
previousKeys.length === 1 && previousKeys[0] === key ? [] : [key]
|
||||
));
|
||||
}, []);
|
||||
|
||||
const handleRowNumberDoubleClick = useCallback((index: number) => {
|
||||
|
||||
Reference in New Issue
Block a user