import { expect } from "e2e";
import { test, WEB } from "./t3.ts";

test("Escape clears the keybindings search and keeps Settings open", WEB, async ({ t3, app, screen, browser }) => {
  await t3.project("demo");
  await t3.open();
  await screen.getByText("demo", { exact: true }).first().tap();
  await app.open("/settings/keybindings");
  const search = screen.getByRole("searchbox", "Search keybindings");
  await search.tap();
  await search.fill("sidebar");
  await app.screenshot("before-escape");
  await browser.keyboard.press("Escape");
  await app.screenshot("after-escape");
  await expect(search).toBeVisible();
  await expect(search).toHaveValue("");
});
