From 46c55496a1a5b511959d6148dea6b4d8f295862c Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:46:48 -0400 Subject: [PATCH] fix(stories): show trimmed-story notice when the popup is blocked Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- scripts/story-dialog.test.mjs | 22 ++++++++++++++++++++++ stories/index.html | 6 ++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/story-dialog.test.mjs b/scripts/story-dialog.test.mjs index fcf9841..8fdca11 100644 --- a/scripts/story-dialog.test.mjs +++ b/scripts/story-dialog.test.mjs @@ -353,6 +353,28 @@ test("popup blocked: fallback link gets the prefilled URL and copy button yields assert.match(t.el("story-status").textContent, /^Copied\./); }); +test("popup blocked with truncated story: fallback revealed and trimmed-story notice shown", async () => { + const t = boot({ popupBlocked: true }); + const long = "x".repeat(STORY_MAX - 3) + " tail-that-gets-cut"; + t.el("opener-hero").dispatch("click"); + t.fill({ ...VALID, "story-text": long }); + t.submit(); + assert.equal(t.el("story-fallback").hidden, false, "fallback revealed"); + assert.match(t.el("story-status").textContent, /^Your story was trimmed to 1500 characters/, "trimmed-story notice shown when popup blocked"); + const href = new URL(t.el("story-fallback-link").href); + const story = href.searchParams.get("story"); + assert.equal(story, "x".repeat(STORY_MAX - 3), "fallback link carries the trimmed story"); +}); + +test("popup blocked with non-truncated story: fallback revealed but no notice shown", () => { + const t = boot({ popupBlocked: true }); + t.el("opener-hero").dispatch("click"); + t.fill(VALID); + t.submit(); + assert.equal(t.el("story-fallback").hidden, false, "fallback revealed"); + assert.equal(t.el("story-status").textContent, "", "no truncation notice when story not truncated"); +}); + test("copy button tells the user to use the prefilled link when the clipboard write is rejected", async () => { const t = boot({ popupBlocked: true, clipboardOverride: { clipboard: { writeText() { return Promise.reject(new Error("denied")); } } } }); t.el("opener-hero").dispatch("click"); diff --git a/stories/index.html b/stories/index.html index 4ebcc5d..62ff193 100644 --- a/stories/index.html +++ b/stories/index.html @@ -2,7 +2,7 @@
- +