mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
0486317f29
* feat: add keyboard shortcuts for agent manager tab/worktree management * fix: use mock.module in git-context tests to avoid cross-file mock leakage * feat: shared worktree delete confirmation dialog with Enter/Esc, Cmd+W fallthrough, Cmd+T race fix * fix: Enter on delete dialog, VS Code theme colors, Cmd+N auto-switch, shortcut hints, smooth neighbor selection on worktree delete * refactor: move confirm dialog styles to kilo-ui, replace 'local' magic string with LOCAL constant * revert: restore upstream commit-message tests, drop our git.ts/GitRunner changes * revert: remove out-of-scope kilo-ui/SessionList/chat.css changes, keep confirm styles in agent-manager.css * fix: remove stale /P reference from comment * fix: move keybinding entries from submenus to keybindings array
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { describe, it, expect } from "bun:test"
|
|
import { nextSelectionAfterDelete, LOCAL } from "../../webview-ui/agent-manager/navigate"
|
|
|
|
describe("nextSelectionAfterDelete", () => {
|
|
it("selects the worktree below when deleting from the middle", () => {
|
|
expect(nextSelectionAfterDelete("b", ["a", "b", "c"])).toBe("c")
|
|
})
|
|
|
|
it("selects the worktree above when deleting the last item", () => {
|
|
expect(nextSelectionAfterDelete("c", ["a", "b", "c"])).toBe("b")
|
|
})
|
|
|
|
it("selects the worktree below when deleting the first item", () => {
|
|
expect(nextSelectionAfterDelete("a", ["a", "b", "c"])).toBe("b")
|
|
})
|
|
|
|
it("falls back to LOCAL when deleting the only worktree", () => {
|
|
expect(nextSelectionAfterDelete("a", ["a"])).toBe(LOCAL)
|
|
})
|
|
|
|
it("falls back to LOCAL when ID is not found", () => {
|
|
expect(nextSelectionAfterDelete("x", ["a", "b"])).toBe(LOCAL)
|
|
})
|
|
|
|
it("falls back to LOCAL when list is empty", () => {
|
|
expect(nextSelectionAfterDelete("a", [])).toBe(LOCAL)
|
|
})
|
|
|
|
it("handles two-item list deleting first", () => {
|
|
expect(nextSelectionAfterDelete("a", ["a", "b"])).toBe("b")
|
|
})
|
|
|
|
it("handles two-item list deleting second", () => {
|
|
expect(nextSelectionAfterDelete("b", ["a", "b"])).toBe("a")
|
|
})
|
|
})
|