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

test("Stash preview has no space before its ellipsis", WEB, async ({ t3, app, browser, screen }) => {
  const project = await t3.project("Preview demo");
  const thread = await t3.thread({ project, title: "Preview spacing", messages: ["Hello"] });
  await browser.setViewport({ width: 2400, height: 1000 });
  await t3.open(thread);
  const composer = screen.getByRole("textbox");
  await composer.fill("Move the theme toggle and the language picker into one row on wide screens, and stack the two on phones so nothing wraps");
  await composer.press("Control+s");
  await screen.getByRole("button", "Stashed prompts: 1. Open stash.").tap();
  const preview = screen.getByRole("button", /^Restore stashed prompt:/);
  await preview.waitFor();
  await app.screenshot("stash-preview");
  await expect(preview).toHaveText("Move the theme toggle and the language picker into one row on wide screens, and stack the…");
});
