Send messages with Ctrl+Enter

Ctrl+Enter (Cmd+Enter on a Mac) submits the buyer's and the owner's message
boxes through the normal form, so the usual checks apply. Plain Enter still
adds a line. The empty box hints at the shortcut. Not added to the publish
description or the address-release note, where it could submit by accident.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 20:55:30 +01:00
co-authored by Claude Sonnet 5.5
parent 19fea7f524
commit 71e6dc8658
7 changed files with 80 additions and 6 deletions
+20
View File
@@ -62,6 +62,26 @@ test("a first message is encrypted, mined and sent; the conversation opens", asy
}
});
test("Ctrl+Enter sends the first message like the button does", async () => {
const before = gw.posted.length;
const p = openPage(gw.url, detail);
try {
await p.waitFor(() => p.document.querySelector("textarea") !== null, "the contact form");
const area = p.document.querySelector("textarea")!;
const press = (init: KeyboardEventInit) => area.dispatchEvent(new p.window.KeyboardEvent("keydown", { key: "Enter", bubbles: true, cancelable: true, ...init }));
area.value = "Per Tastatur gesendet";
assert.equal(press({}), true, "a plain Enter only adds a line");
await new Promise((r) => setTimeout(r, 50));
assert.equal(gw.posted.length, before);
press({ ctrlKey: true });
await p.waitFor(() => p.window.location.hash.startsWith("#/c/"), "the conversation view");
assert.equal(gw.posted.length, before + 1);
assert.equal(openAsOwner(JSON.parse(gw.posted[before]!) as Envelope, owner).text, "Per Tastatur gesendet");
} finally {
p.close();
}
});
test("links are refused in a first message, and nothing is sent", async () => {
const before = gw.posted.length;
const p = openPage(gw.url, detail);