fix(desk): a row's keep, release and wipe take no room of their own
Operator, on the live Desk: "release and x take up space whether or not they're visible." They sat in a side column at opacity 0, which hides a control and still reserves its box, and hover-only never worked on touch. Each control now sits on the facts line beside the state it changes: release after "kept", keep after a countdown or hold, wipe last. They are always visible and quiet, and wipe turns danger only under the pointer or focus. The side column renders only when the row carries a badge. The row is flex, so an absent column costs no gap. Forms, POST targets and data-confirm wording are unchanged. The flex row exposed a latent sizing bug: the stacked Desk column was a bare 1fr, whose minimum is its content's, so a long nowrap provenance line scrolled the page sideways at phone width (1029px at 390). It is now minmax(0,1fr). Both behaviours have browser tests, mutation-proved (r2_flow.toml: 21/21). Contract C4 amended.
This commit is contained in:
@@ -374,3 +374,61 @@ def test_the_next_arrow_clears_the_rail_only_beside_it(browser, live):
|
||||
"getComputedStyle(document.querySelector('.vnav.vnext')).right")
|
||||
page.close()
|
||||
assert rights == {1400: "360px", 390: "0px"}
|
||||
|
||||
|
||||
def test_a_rows_keep_release_and_wipe_take_no_room_of_their_own(browser, live):
|
||||
"""Operator, on the live Desk: 'release and x take up space whether or not
|
||||
they're visible.' They were `opacity:0` in their own side column, which
|
||||
hides a control and still reserves its box. Each now sits on the facts
|
||||
line beside the state it changes, visible without hover (a touch screen
|
||||
never had hover), so a row with no badge has no side column at all."""
|
||||
import os
|
||||
base, root = live
|
||||
past = time.time() - 10_000
|
||||
for name, kept in (("kept1", True), ("loose", False)):
|
||||
d = root / name
|
||||
d.mkdir()
|
||||
(d / "a.png").write_bytes(PNG)
|
||||
os.utime(d / "a.png", (past, past))
|
||||
(d / ".viewed").write_bytes(b"") # looked at since: no 'new' badge
|
||||
if kept:
|
||||
(d / ".forever").write_bytes(b"")
|
||||
page = browser.new_page(viewport={"width": 1400, "height": 900})
|
||||
page.goto(f"{base}/", wait_until="networkidle")
|
||||
page.mouse.move(0, 0) # nothing hovered
|
||||
out = {}
|
||||
for name, form in (("kept1", "form.release"), ("kept1", "form.wipe-kept"),
|
||||
("loose", "form.keepit"), ("loose", "form.wipe")):
|
||||
btn = page.locator(f'.desk-row[data-booth="{name}"] {form} button')
|
||||
out[(name, form)] = btn.is_visible() and btn.evaluate(
|
||||
"b => { for (let e = b; e; e = e.parentElement)"
|
||||
" if (getComputedStyle(e).opacity === '0') return false;"
|
||||
" return true; }")
|
||||
gaps = page.evaluate("""() => [...document.querySelectorAll('.desk-row')].map(r => {
|
||||
const row = r.getBoundingClientRect(), main = r.querySelector('.desk-main').getBoundingClientRect();
|
||||
return Math.round(row.right - main.right); })""")
|
||||
page.close()
|
||||
assert all(out.values()), out
|
||||
# row padding (12) + border (1) + nothing else: no side column is reserved
|
||||
assert gaps and max(gaps) <= 14, gaps
|
||||
|
||||
|
||||
def test_the_desk_never_scrolls_sideways_on_a_phone(browser, live):
|
||||
"""The row-controls change made a Desk row a flex container, and a long
|
||||
provenance line (nowrap, ellipsised) then set the Desk column's MINIMUM
|
||||
width: at 390px the page scrolled sideways to 1029px. The column is capped
|
||||
at the space it has; the ellipsis does the rest."""
|
||||
from booth.manifest import write_manifest
|
||||
base, root = live
|
||||
d = root / "longwhy"
|
||||
d.mkdir()
|
||||
(d / "a.png").write_bytes(PNG)
|
||||
write_manifest(d, "design-dev", title="A set with a long reason",
|
||||
why="a reason long enough to overflow any phone " * 6)
|
||||
widths = {}
|
||||
for w in (390, 1400):
|
||||
page = browser.new_page(viewport={"width": w, "height": 844})
|
||||
page.goto(f"{base}/", wait_until="networkidle")
|
||||
widths[w] = page.evaluate("document.documentElement.scrollWidth")
|
||||
page.close()
|
||||
assert widths == {390: 390, 1400: 1400}, widths
|
||||
|
||||
Reference in New Issue
Block a user