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

test("Automatic project monograms preserve each selected initial", WEB, async ({ t3, app, screen, browser }) => {
  const digit = await t3.project("ß2");
  await t3.project("ᾠδή");
  await t3.project("Fuß");
  const thread = await t3.thread({ project: digit, title: "Project icon check", messages: ["hello"] });
  await t3.open(thread);
  await screen.getByRole("combobox", "Projects").tap();
  await screen.getByRole("option").filter({ hasText: "ᾠδή" }).waitFor();
  await app.screenshot("automatic-project-monograms");
  for (const [name, monogram] of [["ß2", "S2"], ["ᾠδή", "ὨΉ"], ["Fuß", "FS"]]) {
    await expect(browser.locator(`[role="option"]:has-text("${name}") [data-slot="project-monogram"] text`)).toHaveText(monogram);
  }
});
