Файли
openidea/src/ui/rowSelection.test.ts
T
l0ng-ai d3e63d8ff0 feat(search): select and open multiple search results (#670)
Search Everywhere and Recent Files lists now support multi-selection: Shift+Up/Down and Shift+click extend a range from the anchor, Cmd/Ctrl+click toggles a row, and Enter opens every selected file, symbol or text result in list order, leaving focus on the lead row. Actions in a mixed selection are skipped; a single selection behaves as before. Selection resets when the query or tab changes.

The row-selection model used by Find in Files moves to src/ui so the shared List can opt into modifier selection.

Fixes #647
2026-11-01 16:05:16 +08:00

23 рядки
950 B
TypeScript

import { describe, expect, it } from "vitest";
import { selectRow, selectedRows } from "./rowSelection";
describe("list selection across sections", () => {
it("selects only options across headers in either direction", () => {
const rows = [
{ key: "files", section: true },
{ key: "a", section: false },
{ key: "symbols", section: true },
{ key: "b", section: false },
{ key: "actions", section: true },
{ key: "c", section: false },
];
const single = { lead: 3, anchor: 3, keys: null };
const section = (row: (typeof rows)[number]) => row.section;
const down = selectRow(rows, single, 5, "range", section);
expect(selectedRows(rows, down).map((r) => r.key)).toEqual(["b", "c"]);
const up = selectRow(rows, down, 1, "range", section);
expect(selectedRows(rows, up).map((r) => r.key)).toEqual(["a", "b"]);
expect(selectRow(rows, up, 2, "toggle", section)).toBe(up);
});
});