Enter now confirms the kill the operator just asked for; Escape and the scrim still cancel.
34 lines
898 B
TypeScript
34 lines
898 B
TypeScript
// @vitest-environment happy-dom
|
|
import { beforeEach, describe, expect, it } from "vitest";
|
|
import {
|
|
closeForceKillDialog,
|
|
openForceKillDialog,
|
|
openKillConfirmDialog,
|
|
} from "./killDialog.js";
|
|
|
|
describe("kill dialogs", () => {
|
|
beforeEach(() => {
|
|
closeForceKillDialog();
|
|
document.body.innerHTML = "";
|
|
});
|
|
|
|
it("focuses the kill button, so Enter confirms", () => {
|
|
const el = openKillConfirmDialog({
|
|
name: "alpha",
|
|
blockers: null,
|
|
onKill: () => Promise.resolve(),
|
|
});
|
|
expect(document.activeElement).toBe(el.querySelector(".kill-dialog-kill"));
|
|
});
|
|
|
|
it("focuses the force button too", () => {
|
|
const el = openForceKillDialog({
|
|
name: "alpha",
|
|
blockers: null,
|
|
reason: "worktree is dirty.",
|
|
onForce: () => Promise.resolve(),
|
|
});
|
|
expect(document.activeElement).toBe(el.querySelector(".kill-dialog-force"));
|
|
});
|
|
});
|