fix(booth): put the blur toggle on every item kind, and make it look like a control
The operator asked "no UI option to blur/unblur?" and was right twice over. MISSING ENTIRELY ON TWO OF THREE BRANCHES. booth.html renders docs, media and everything-else through separate <figure> blocks. The toggle went into the media branch only, so inline docs -- the branch that puts readable text straight on the page, the one that needs blur most -- had no control at all, and `other` files only got a caption row if they happened to carry a caption. This is the SECOND time this feature shipped having patched some branches and not others; the blurred class itself had the same gap one commit ago. So the toggle is now a single Jinja macro called from all three sites, which makes "patched two of three" impossible rather than merely unlikely, and test_every_item_kind_gets_exactly_one_blur_toggle counts toggles against figures across mixed kinds so a fourth branch cannot quietly skip it. INVISIBLE WHERE IT DID RENDER. v1 was a bare `◌` at 0.78rem in --muted with no border, no label and no hover affordance. It now reads `◌ blur` / `◉ blurred` with a border, matching the other per-item controls. A control nobody can find is a control that is not there. Docs get it in the doc bar beside ⤢ ⬇ ✕, with stopPropagation so submitting it does not collapse the <details> it lives inside. Verified live on all three kinds: 3 figures, 3 toggles, and the POST round trip blurs and un-blurs. 167 tests pass.
This commit is contained in:
@@ -1447,3 +1447,43 @@ def test_blur_applies_to_inline_docs_not_just_images(client):
|
||||
assert body.count('<figure class="item item-doc blurred"') == 1, (
|
||||
"exactly the blurred doc, not every doc"
|
||||
)
|
||||
|
||||
|
||||
def test_every_item_kind_gets_exactly_one_blur_toggle(client):
|
||||
"""The regression guard for this whole feature's recurring bug.
|
||||
|
||||
booth.html has THREE item branches — doc, media, other — and each pass at
|
||||
this feature patched some and missed others: first the blurred class landed
|
||||
on media only, then the toggle landed on media only and the operator asked
|
||||
"no UI option to blur/unblur?". A count assertion across mixed kinds is the
|
||||
check that actually catches it; a spot check on one item never will.
|
||||
"""
|
||||
c, root = client
|
||||
d = root / "bo"
|
||||
d.mkdir()
|
||||
(d / "note.txt").write_text("doc branch") # -> item-doc
|
||||
_png(d / "pic.png") # -> item-image
|
||||
(d / "blob.bin").write_bytes(b"\x00\x01binary") # -> item-other
|
||||
|
||||
body = c.get("/b/bo/").text
|
||||
figures = body.count('<figure class="item item-')
|
||||
toggles = body.count('class="blurtoggle')
|
||||
assert figures == 3, f"expected all three kinds to render, got {figures}"
|
||||
assert toggles == figures, (
|
||||
f"{figures} items but {toggles} blur toggles — a branch was missed again"
|
||||
)
|
||||
|
||||
|
||||
def test_blur_toggle_posts_the_opposite_state(client):
|
||||
"""The button must flip, not just set. A toggle hard-coded to on=1 looks
|
||||
identical in the markup and silently cannot un-blur."""
|
||||
c, root = client
|
||||
d = root / "bo"
|
||||
d.mkdir()
|
||||
_png(d / "pic.png")
|
||||
|
||||
assert 'name="on" value="1"' in c.get("/b/bo/").text
|
||||
set_blurred(d, "pic.png", True)
|
||||
body = c.get("/b/bo/").text
|
||||
assert 'name="on" value="0"' in body, "a blurred item must offer un-blur"
|
||||
assert "◉ blurred" in body
|
||||
|
||||
Reference in New Issue
Block a user