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

test("Ctrl+Backspace below a numbered list joins the final item", WEB, async ({ t3, app, browser, screen }) => {
  const project = await t3.project("demo");
  const thread = await t3.thread({ project, title: "List editing", messages: ["Start"] });
  await t3.open(thread);
  const composer = screen.getByRole("textbox");
  await composer.tap();
  await browser.keyboard.type("1. a");
  await browser.keyboard.press("Shift+Enter");
  await browser.keyboard.press("Shift+Enter");
  await browser.keyboard.type("b");
  await browser.keyboard.press("Home");
  await app.screenshot("before-keypress");
  await browser.keyboard.press("Control+Backspace");
  await app.screenshot("after-ctrl-backspace");
  await expect(browser.locator('[role="textbox"] ol')).toHaveText("ab");
});
