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

test("Literal braces keep the indexed file available in @ search", WEB, async ({ t3, app, screen }) => {
  const project = await t3.project("brace-search", {
    "src/foo{bar}.ts": "export const example = true;\n",
  });
  await t3.thread({ project, title: "File search", messages: [] });
  await t3.open();
  await screen.getByRole("button", "File search, Done, brace-search").tap();
  const composer = screen.getByRole("textbox");
  await composer.pressSequentially("@foo");
  const file = screen.getByText("foo{bar}.ts", { exact: true });
  await expect(file).toBeVisible();
  await app.screenshot("prefix-search");
  await composer.pressSequentially("{bar}.ts", { delay: 250 });
  try {
    await expect(file).toBeVisible();
  } finally {
    await app.screenshot("literal-basename-search");
  }
  await file.tap();
  await app.screenshot("file-selected");
});
