Puzzles: bigger buttons and clearer city chips on phones
On phones the puzzle card's Undo, Reset, Back and menu buttons are 40 px touch targets and stay pinned at the foot of the sheet when longer languages make it scroll. Goal cities show a leading mark (○ to reach, ◐ POP open, ✓ joined) instead of a trailing one that looked cut off.
This commit is contained in:
parent
28743698a3
commit
f4980dc098
3 changed files with 28 additions and 2 deletions
|
|
@ -391,3 +391,23 @@ test('a city to avoid reads as a rule, not a goal that can fail', () => {
|
|||
assert.equal(evalP(ev).stars, 3);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('phone sheet: 40 px touch targets, pinned actions, and goal chips with a clear mark', () => {
|
||||
const { ev, errors } = load();
|
||||
// jsdom has no layout: read the phone media rules from the page's stylesheet (Chromium at 360 px measures 40 px).
|
||||
const rules = JSON.parse(ev(`JSON.stringify([...document.styleSheets].flatMap(s=>[...s.cssRules]).filter(r=>r.media&&/max-width: ?760px/.test(r.media.mediaText))
|
||||
.flatMap(m=>[...m.cssRules]).filter(r=>/#pzBox/.test(r.selectorText||'')).map(r=>({sel:r.selectorText,mh:r.style.getPropertyValue('min-height'),mw:r.style.getPropertyValue('min-width'),pos:r.style.getPropertyValue('position'),bottom:r.style.getPropertyValue('bottom')})))`));
|
||||
const tap = rules.find((r) => /#pzBox \.btns \.b/.test(r.sel) && /#pzBox \.pzh \.b/.test(r.sel));
|
||||
assert.ok(tap && parseFloat(tap.mh) >= 40 && parseFloat(tap.mw) >= 40, `Undo/Reset/Back/☰ are at least 40 px (${JSON.stringify(tap)})`);
|
||||
const pin = rules.find((r) => /^#pzBox ?> ?\.btns$/.test(r.sel));
|
||||
assert.ok(pin && pin.pos === 'sticky' && parseFloat(pin.bottom) === 0, `the action row stays at the foot of a scrolling sheet (${JSON.stringify(pin)})`);
|
||||
ev("innerWidth=360;innerHeight=740;dispatchEvent(new Event('resize'));pzBegin(pzDef('braces'))");
|
||||
const chips = () => ev("[...document.querySelectorAll('#pzBox .pzc')].map(x=>x.textContent).join('|')");
|
||||
assert.equal(chips(), '○ New York|○ London|○ Dublin', 'not reached yet: a hollow mark, nothing that looks cut off');
|
||||
assert.doesNotMatch(chips(), /…/);
|
||||
build(ev, [['nyc', 'lon', 'grace']]);
|
||||
ev("ACT.pzPop({city:'dub'})");
|
||||
assert.equal(chips(), '✓ New York|✓ London|◐ Dublin');
|
||||
assert.ok(ev("[...document.querySelectorAll('#pzBox button')].every(b=>b.classList.contains('b'))"), 'every sheet button is a .b the rule sizes');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue