Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(view): the items toolbar is one row: list, filter, new [N26]
Corey Olson2f6745b6691b
diff --git a/src/cockpit.js b/src/cockpit.jsindex f1afc9af..e365c026 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -106,8 +106,11 @@ export function cockpitPage(key = '', { snapshot = false, readOnly = false, requ<section data-pane="items" class="two"><div class="primary"><section class="card-panel proof-stats" id="proof-stats" aria-label="Board proof stats" hidden></section>- <div class="items-view-switch seg" id="items-view-switch" role="group" aria-label="Items view"></div>- <div class="card-panel toolbar"><div class="seg" id="state-chips" role="group" aria-label="Show"></div><select class="lane-pick" id="lane-pick" aria-label="Lane"></select><button class="go" id="new-item" type="button">New item</button></div>+ <div class="card-panel toolbar">+ <div class="items-view-switch seg" id="items-view-switch" role="group" aria-label="Items view"></div>+ <div class="filter-control"><button class="filter-toggle" id="filter-toggle" data-filter-toggle type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="filter-menu"><span class="filter-label" id="filter-label">Filter</span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div class="filter-menu" id="filter-menu" role="menu" aria-label="Filter" hidden></div></div>+ <button class="go" id="new-item" type="button" aria-label="New item"><span class="new-item-wide">New item</span><span class="new-item-narrow" aria-hidden="true">New</span></button>+ </div><div class="card-panel list-card" id="item-list"><ol class="needs" id="needs" aria-label="What needs you" hidden></ol><ol class="chain" id="chain" aria-label="Items"></ol></div><ol class="pipeline" id="pipeline" aria-label="Item pipeline" hidden></ol></div>@@ -184,7 +187,7 @@ function homeTab() {const kept = keep('pb.tab');return kept && kept !== 'roadmap' ? kept : 'items';}-const view = { roadmapOpen: new Map(), root: keep('pb.project'), tab: addressTab() || homeTab(), itemsView: typeof location !== 'undefined' && location.hash === '#items/pipeline' ? 'pipeline' : 'list', seen: {}, code: {}, item: null, adding: false, declining: null, state: 'active', rows: { spec: 'decide', doctrine: 'all' }, row: { spec: null, doctrine: null }, agent: null, allAgents: false, agentsHidden: keep('pb.agents') === 'hidden', statsOpen: false, open: {} };+const view = { roadmapOpen: new Map(), root: keep('pb.project'), tab: addressTab() || homeTab(), itemsView: typeof location !== 'undefined' && location.hash === '#items/pipeline' ? 'pipeline' : 'list', filterOpen: false, seen: {}, code: {}, item: null, adding: false, declining: null, state: 'active', rows: { spec: 'decide', doctrine: 'all' }, row: { spec: null, doctrine: null }, agent: null, allAgents: false, agentsHidden: keep('pb.agents') === 'hidden', statsOpen: false, open: {} };let switchGeneration = 0;if (snapshot) view.state = 'all';let data = null;@@ -1425,10 +1428,9 @@ function render() {const q = $('q').value.trim().toLowerCase();const pipeline = view.itemsView === 'pipeline';$('items-view-switch').innerHTML = ['list', 'pipeline'].map((mode) => '<button type="button" data-items-view="' + mode + '" aria-pressed="' + (view.itemsView === mode) + '" class="' + (view.itemsView === mode ? 'on' : '') + '">' + (mode === 'list' ? 'List' : 'Pipeline') + '</button>').join('');- $('state-chips').hidden = pipeline;$('item-list').hidden = pipeline;$('pipeline').hidden = !pipeline;- // Each chip counts what it would show under the lane and the search. A search looks through every+ // Each Show choice counts what it would show under the lane and the search. A search looks through every// state, withdrawn items included; browsing leaves those out.const matching = (q ? p.items : items).filter((i) => !q || ('#' + i.id + ' ' + i.title + ' ' + i.lane + ' ' + i.specs.join(' ') + ' ' + (i.criterion || '')).toLowerCase().includes(q));@@ -1443,15 +1445,26 @@ function render() {// A lane narrows the list as a state does, and each counts within the other's choice.const inLane = (lane) => (i) => !lane || i.lane === lane;if (view.lane && !matching.some(inLane(view.lane))) view.lane = null;- $('state-chips').innerHTML = Object.keys(names).map((s) => '<button data-state="' + s + '" class="' + (view.state === s ? 'on' : '') + '" type="button">' + names[s] + '<b>' + matching.filter(inLane(view.lane)).filter(inState(s)).length + '</b></button>').join('');+ const stateOptions = Object.keys(names).map((s) => '<button class="filter-option" role="menuitemradio" aria-checked="' + (view.state === s) + '" data-filter-choice="state:' + s + '" data-filter-kind="state" data-filter-value="' + s + '" data-state="' + s + '" type="button"><span class="filter-option-label">' + names[s] + '</span><b>' + matching.filter(inLane(view.lane)).filter(inState(s)).length + '</b></button>');const inView = pipeline ? matching.filter((item) => item.status !== 'withdrawn') : matching.filter(inState(view.state));const laneCounts = [...inView.reduce((m, i) => m.set(i.lane, (m.get(i.lane) || 0) + 1), new Map())].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));if (view.lane && !laneCounts.some(([lane]) => lane === view.lane)) laneCounts.push([view.lane, 0]);- const pick = $('lane-pick'), options = [['', 'All lanes'], ...laneCounts.map(([lane, n]) => [lane, lane + ' · ' + n])].map(([lane, label]) => '<option value="' + esc(lane) + '">' + esc(label) + '</option>').join('');- // Rewriting an open picker closes it, so it is rewritten only when the lanes or their counts change.- if (pick.dataset.options !== options) { pick.innerHTML = options; pick.dataset.options = options; }- pick.value = view.lane || '';- pick.hidden = laneCounts.length < 2 && !view.lane;+ const laneOptions = [['', 'All lanes', null], ...laneCounts.map(([lane, n]) => [lane, lane, n])].map(([lane, label, count]) => '<button class="filter-option" role="menuitemradio" aria-checked="' + ((view.lane || '') === lane) + '" data-filter-choice="lane:' + esc(lane) + '" data-filter-kind="lane" data-filter-value="' + esc(lane) + '" aria-label="' + esc(label) + (count === null ? '' : ' · ' + count) + '" title="' + esc(label) + (count === null ? '' : ' · ' + count) + '" type="button"><span class="filter-option-label">' + esc(label) + '</span>' + (count === null ? '' : '<b>' + count + '</b>') + '</button>');+ const activeChoice = document.activeElement?.dataset?.filterChoice;+ const menu = $('filter-menu');+ menu.innerHTML = (pipeline ? '' : '<section class="filter-group" role="group" aria-label="Show"><h3>Show</h3>' + stateOptions.join('') + '</section>')+ + '<section class="filter-group" role="group" aria-label="Lane"><h3>Lane</h3>' + laneOptions.join('') + '</section>';+ menu.hidden = !view.filterOpen;+ menu.style.left = '0px';+ if (view.filterOpen) menu.style.left = Math.min(0, innerWidth - 16 - menu.getBoundingClientRect().right) + 'px';+ $('filter-toggle').setAttribute('aria-expanded', String(view.filterOpen));+ const stateLabel = pipeline || view.state === 'active' ? '' : names[view.state] || '';+ const laneLabel = view.lane || '';+ const filterLabel = stateLabel || laneLabel ? 'Filter: ' + [stateLabel, laneLabel].filter(Boolean).join(' · ') : 'Filter';+ $('filter-label').textContent = filterLabel;+ $('filter-toggle').setAttribute('aria-label', filterLabel);+ $('filter-toggle').title = filterLabel;+ if (view.filterOpen && activeChoice) [...menu.querySelectorAll('[data-filter-choice]')].find((option) => option.dataset.filterChoice === activeChoice)?.focus({ preventScroll: true });const shown = inView.filter(inLane(view.lane)).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));$('pipeline').innerHTML = pipeline ? pipelineCard(shown) : '';// With nothing picked, the detail shows the first row, and keeps it when a refresh reorders the list.@@ -2242,7 +2255,8 @@ $('shouts-pane').addEventListener('click', (event) => {// Enter shouts; Shift+Enter starts a new line.$('shout-text').addEventListener('keydown', (event) => { if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) { event.preventDefault(); $('shout-form').requestSubmit(); } });document.addEventListener('click', (event) => {- const t = event.target.closest('[data-status],[data-roadmap-key],[data-roadmap-all],[data-root],[data-tab],[data-go],[data-item],[data-items-view],[data-state],[data-rows],[data-row],[data-row-decision],[data-section-approve],[data-release],[data-shout],[data-new],[data-code],[data-code-all],[data-code-less],[data-stats-toggle],#proj-switch,#console');+ if (view.filterOpen && !event.target.closest('.filter-control')) { view.filterOpen = false; render(); }+ const t = event.target.closest('[data-filter-toggle],[data-filter-choice],[data-status],[data-roadmap-key],[data-roadmap-all],[data-root],[data-tab],[data-go],[data-item],[data-items-view],[data-state],[data-rows],[data-row],[data-row-decision],[data-section-approve],[data-release],[data-shout],[data-new],[data-code],[data-code-all],[data-code-less],[data-stats-toggle],#proj-switch,#console');if (!event.target.closest('.side')) fold(false);if (!t) return;if (t.id === 'proj-switch') { fold(!$('side').classList.contains('open')); return; }@@ -2254,6 +2268,15 @@ document.addEventListener('click', (event) => {return;}if (t.dataset.status) { statusGo(t.dataset.status); return; }+ if (t.dataset.filterToggle !== undefined) { view.filterOpen = !view.filterOpen; render(); return; }+ if (t.dataset.filterChoice) {+ if (t.dataset.filterKind === 'state') view.state = t.dataset.filterValue;+ else view.lane = t.dataset.filterValue || null;+ view.filterOpen = false;+ render();+ $('filter-toggle').focus({ preventScroll: true });+ return;+ }if (t.dataset.itemsView) { view.itemsView = t.dataset.itemsView; address(); render(); return; }if ('roadmapKey' in t.dataset) {const key = t.dataset.roadmapKey;@@ -2386,13 +2409,31 @@ $('q').addEventListener('blur', () => {closingFound = setTimeout(() => hideFound('left the field'), 120);});// "/" goes to the search from anywhere but a field.+document.addEventListener('keydown', (event) => {+ if (!view.filterOpen) return;+ if (event.key === 'Escape') {+ event.preventDefault();+ view.filterOpen = false;+ render();+ $('filter-toggle').focus({ preventScroll: true });+ return;+ }+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {+ const choices = [...$('filter-menu').querySelectorAll('[data-filter-choice]')];+ const at = choices.indexOf(document.activeElement);+ if (choices.length) {+ event.preventDefault();+ const next = at < 0 ? (event.key === 'ArrowDown' ? 0 : choices.length - 1) : (at + (event.key === 'ArrowDown' ? 1 : choices.length - 1)) % choices.length;+ choices[next].focus({ preventScroll: true });+ }+ }+});document.addEventListener('keydown', (event) => {if (event.key !== '/' || event.metaKey || event.ctrlKey || event.altKey || event.target.closest('input, textarea, select, [contenteditable]')) return;event.preventDefault();$('q').focus();$('q').select();});-$('lane-pick').addEventListener('change', (event) => { view.lane = event.target.value || null; render(); });$('add-form').addEventListener('submit', async (event) => {event.preventDefault();if (await act('add', { lane: $('add-lane').value, title: $('add-title').value, criterion: $('add-criterion').value, specs: $('add-specs').value, brief: $('add-brief').value }, event.currentTarget)) {diff --git a/src/view.css b/src/view.cssindex 1fcfd681..22561396 100644--- a/src/view.css+++ b/src/view.css@@ -192,7 +192,7 @@ main { padding: 16px 18px 56px; }.tab { display: grid; justify-items: center; align-content: center; padding: 7px 2px; font-size: clamp(11px, 3.6vw, 13.5px); }}.primary { display: grid; gap: 12px; min-width: 0; }-.items-view-switch { justify-self: start; }+.items-view-switch { flex: none; flex-wrap: nowrap; max-width: none; }.pipeline { display: grid; gap: 24px; list-style: none; margin: 0; padding: 0; min-width: 0; }.pipeline-stage { position: relative; min-width: 0; padding: 14px; }.pipeline-stage + .pipeline-stage::before { content: '↓'; position: absolute; top: -25px; left: 22px; color: var(--ink-faint); }@@ -206,11 +206,27 @@ main { padding: 16px 18px 56px; }.pipeline-item > span:first-child { color: var(--ink-faint); font-family: var(--mono); }.pipeline-item > span:last-child { overflow-wrap: anywhere; }.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }-/* The Items toolbar is one row: the states, the lane picker, and New item at its end. */-.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; }-.toolbar .lane-pick { flex: none; field-sizing: content; max-width: 11em; padding: 0 8px; color: var(--ink-muted); font-size: 13px; cursor: pointer; }-.toolbar .lane-pick[hidden] { display: none; }-.toolbar .go { margin-left: auto; }+/* The Items toolbar keeps its view, filters, and creation action together on one line. */+.toolbar { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; min-width: 0; padding: 10px; }+.toolbar .go { flex: none; margin-left: auto; }+.items-view-switch button { padding-inline: 5px; }+/* Filter is a button sized to its words, beside List | Pipeline; a long choice gives way with an ellipsis, never the row.+ Its arrow points the way the menu goes, as the project switcher's does, switching at once. */+.filter-control { position: relative; flex: 0 1 auto; min-width: 0; }+.filter-toggle { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; min-height: var(--tap); padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; }+.filter-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }+.filter-toggle svg { flex: none; width: 16px; height: 16px; color: var(--ink-faint); }+.filter-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }+.filter-toggle:hover, .filter-toggle[aria-expanded="true"] { background: var(--surface-2); }+.filter-menu { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; display: grid; gap: 10px; width: max-content; min-width: 220px; max-width: min(320px, calc(100vw - 32px)); padding: 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }+.filter-group { display: grid; gap: 2px; min-width: 0; }+.filter-group h3 { margin: 0 6px 2px; color: var(--ink-faint); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }+.filter-option { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: 100%; min-height: var(--tap); padding: 5px 8px; border: 0; border-radius: 7px; background: none; color: var(--ink); text-align: left; white-space: nowrap; cursor: pointer; }+.filter-option:hover, .filter-option:focus-visible { background: var(--surface-2); }+.filter-option[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }+.filter-option-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }+.filter-option b { flex: none; color: var(--ink-faint); font: 600 11px var(--mono); }+.new-item-narrow { display: none; }input, select, textarea { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 7px 9px; min-width: 0; }input:disabled { background: var(--surface-2); color: var(--ink-muted); }.go { border: 0; background: var(--ink); color: var(--surface); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }@@ -546,21 +562,15 @@ code.inline.long { white-space: break-spaces; overflow-wrap: anywhere; }/* A clickable row is never shorter than the target. */[data-item], [data-row] { min-height: var(--tap); }/* The Items toolbar's controls stand at the target, 32px under a mouse. */-.seg button, .toolbar .go, .toolbar select, .toolbar input { min-height: var(--tap); }-.toolbar .go, .toolbar select, .toolbar input { padding-block: 0; }+.seg button, .toolbar .go, .toolbar input, .filter-toggle, .filter-option { min-height: var(--tap); }+.toolbar .go, .toolbar input { padding-block: 0; }.seg { flex-wrap: wrap; max-width: 100%; }.inline > label { min-width: 0; }-/* On a phone the Items toolbar is one row, Active and Verified with New item at its end, as the person chose; All and- * the lane picker drop out unless one of them is what narrows the list now. While a filter beyond Active and Verified- * shows, New item is a + (its name is still New item), so the row holds both filters; a long lane name gives way, the- * picker shrinking to show what it can, rather than the row. */+/* The label changes at 900px, while the control keeps its accessible name at every size. */+@media (width < 900px) { .new-item-wide { display: none; } .new-item-narrow { display: inline; } }@media (width < 480px) {- .toolbar { flex-wrap: nowrap; }- .toolbar .seg, .toolbar .go { flex: none; }- .toolbar .lane-pick { flex: 0 1 auto; min-width: 4em; }- .toolbar .seg [data-state="all"]:not(.on), .toolbar .lane-pick:not(:has(option:checked:not([value=""]))) { display: none; }- .toolbar:has(.seg button.on:not([data-state="active"]):not([data-state="verified"]), .lane-pick option:checked:not([value=""])) .go { width: var(--tap); padding: 0; font-size: 0; }- .toolbar:has(.seg button.on:not([data-state="active"]):not([data-state="verified"]), .lane-pick option:checked:not([value=""])) .go::before { content: "+"; font-size: 22px; font-weight: 500; line-height: 1; }+ .toolbar { gap: 6px; padding-inline: 8px; }+ .toolbar .go { padding-inline: 12px; }}.spec-feedback { margin: 8px 0; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; overflow-wrap: anywhere; font-size: 13px; }diff --git a/test/cockpit/agents.test.js b/test/cockpit/agents.test.jsindex a742fd6f..f3fe56fe 100644--- a/test/cockpit/agents.test.js+++ b/test/cockpit/agents.test.js@@ -13,7 +13,7 @@ import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../../src/person.js';import { runFixtureChildAsync } from '../fixture-child.js';import { startChrome } from '../relay-browser-fixture.js';import { stableChrome } from './stable.js';-import { BIN, tapTarget, SPEC, machine, project, build, sendBack, startView, openPage, agentEntries, accept, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, earlier, shoutsAt, press, settled } from './fixture.js';+import { BIN, tapTarget, SPEC, machine, project, build, sendBack, startView, openPage, agentEntries, accept, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, earlier, shoutsAt, press, settled, chooseFilter } from './fixture.js';test('the agents panel says what each agent holds [N26]', async () => {@@ -213,7 +213,7 @@ test('agent model display names follow the API on phone and desktop [O8,N26]', {await settled(chrome, `innerWidth === ${width}`);const at = `${style} ${width}`;await tab('items');- await press(chrome, 'document.querySelector("[data-state=active]")');+ await chooseFilter(chrome, 'state:active');await settled(chrome, '!!document.querySelector("#chain [data-item=\\"1\\"]")');assert.equal(await text('#chain [data-item="1"] .chip'), expected.builder, `${at}: item row holder`);assert.equal(await text('#chain [data-item="3"] .chip'), expected.unknown, `${at}: unknown model row`);@@ -222,7 +222,7 @@ test('agent model display names follow the API on phone and desktop [O8,N26]', {assert.ok((await text('#detail')).includes(expected.builder), `${at}: held item detail`);assert.equal(await text('#needs .row[data-go^="decide:"] .meta'), 'NEEDS YOU a decision, asked by ' + expected.reviewer, `${at}: Needs-you decision author`);assert.ok((await text('#needs .row[data-go="tab:shouts"] .meta')).includes('lane held by ' + expected.reviewer), `${at}: Needs-you lane holder`);- await press(chrome, 'document.querySelector("[data-state=verified]")');+ await chooseFilter(chrome, 'state:verified');await settled(chrome, '!!document.querySelector("#chain [data-item=\\"2\\"]")');await press(chrome, 'document.querySelector("#chain [data-item=\\"2\\"]")');await settled(chrome, 'view.item === 2');diff --git a/test/cockpit/fixture.js b/test/cockpit/fixture.jsindex 26be51fe..f602b514 100644--- a/test/cockpit/fixture.js+++ b/test/cockpit/fixture.js@@ -815,6 +815,17 @@ async function travel(chrome, step) {await chrome.send('Page.navigateToHistoryEntry', { entryId: entries[currentIndex + step].id });}+/**+ * Choose a Show or Lane option from the Items toolbar's Filter menu as a person does: open the menu, press the+ * option, and wait for the menu to close (#429). A choice is "state:<state>" or "lane:<lane>".+ */+async function chooseFilter(chrome, choice) {+ await press(chrome, "document.querySelector('#filter-toggle')");+ await chrome.waitFor("!document.querySelector('#filter-menu').hidden");+ await press(chrome, `document.querySelector('#filter-menu [data-filter-choice="${choice}"]')`);+ await chrome.waitFor("document.querySelector('#filter-menu').hidden");+}+/** Wait for a condition after a press; if it never arrives, say what the page shows and where the press landed. */async function pressedInto(chrome, expression, timeoutMs = 10_000) {try {@@ -974,4 +985,4 @@ async function searchFor(chrome, words, timeoutMs) {}}-export { BIN, scratch, tapTarget, SPEC, machine, project, build, sendBack, fetchReason, fetchView, fetchLive, startView, styleOf, element, ageNodes, target, settle, storage, daysOn, openPage, projectRows, productEntries, timelineRows, agentEntries, drawing, textBoxes, meet, accept, needEntries, itemRow, boardId, boardOf, assertObservationAges, withoutObservationAges, assertObservationsEqual, shoutNameText, chromeExecutable, browserPause, startSnapshotChrome, openSnapshotChrome, stopOwnedChrome, closeSnapshotChrome, watchSpecDecisionWait, earlier, shoutsAt, press, tapTouch, pickProject, travel, pressedInto, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, tabBar, serveFolder, proofShot, searchFor };+export { BIN, scratch, chooseFilter, tapTarget, SPEC, machine, project, build, sendBack, fetchReason, fetchView, fetchLive, startView, styleOf, element, ageNodes, target, settle, storage, daysOn, openPage, projectRows, productEntries, timelineRows, agentEntries, drawing, textBoxes, meet, accept, needEntries, itemRow, boardId, boardOf, assertObservationAges, withoutObservationAges, assertObservationsEqual, shoutNameText, chromeExecutable, browserPause, startSnapshotChrome, openSnapshotChrome, stopOwnedChrome, closeSnapshotChrome, watchSpecDecisionWait, earlier, shoutsAt, press, tapTouch, pickProject, travel, pressedInto, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, tabBar, serveFolder, proofShot, searchFor };diff --git a/test/cockpit/items.test.js b/test/cockpit/items.test.jsindex 6181fbdb..b36ccafd 100644--- a/test/cockpit/items.test.js+++ b/test/cockpit/items.test.js@@ -7,7 +7,7 @@ import { join } from 'node:path';import { test } from 'node:test';import * as store from '../../src/board.js';import { addItem, closeBoard, completeCheckBaseline, openBoard } from '../../src/board.js';-import { tapTarget, SPEC, machine, project, build, sendBack, startView, element, target, openPage, agentEntries, accept, itemRow, boardOf, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, settled, earlier, press, travel } from './fixture.js';+import { tapTarget, SPEC, machine, project, build, sendBack, startView, element, target, openPage, agentEntries, accept, itemRow, boardOf, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, settled, earlier, press, travel, chooseFilter } from './fixture.js';test('an added item confirmation names its returned id [A3,N27]', async () => {@@ -316,7 +316,7 @@ test('the list shows active, verified or all [N26]', async () => {const view = await startView(box);try {const page = await openPage(view);- const control = () => [...page.show('state-chips').matchAll(/<button data-state="([a-z]+)" class="(on)?" type="button">([A-Za-z]+)<b>(\d+)<\/b><\/button>/g)].map((match) => `${match[3]} ${match[4]}${match[2] ? ' (shown)' : ''}`);+ const control = () => [...page.show('filter-menu').matchAll(/<button class="filter-option" role="menuitemradio" aria-checked="(true|false)" data-filter-choice="state:([a-z]+)"[^>]*><span class="filter-option-label">([A-Za-z ]+)<\/span><b>(\d+)<\/b><\/button>/g)].map((match) => `${match[3]} ${match[4]}${match[1] === 'true' ? ' (shown)' : ''}`);const rows = () => [...page.show('chain').matchAll(/data-item="(\d+)"/g)].map((match) => Number(match[1])).sort();assert.deepEqual(control(), ['Active 1 (shown)', 'Verified 1', 'All 2'], 'three choices, each with its count');assert.deepEqual(rows(), [2]);@@ -324,7 +324,8 @@ test('the list shows active, verified or all [N26]', async () => {assert.deepEqual(rows(), [1]);await page.click({ state: 'all' });assert.deepEqual(rows(), [1, 2]);- assert.match(page.html, /<div class="card-panel toolbar"><div class="seg" id="state-chips" role="group" aria-label="Show"><\/div><select class="lane-pick" id="lane-pick" aria-label="Lane"><\/select><button class="go" id="new-item"/, 'the control sits in the toolbar beside the lane picker and New item');+ assert.match(page.html, /<div class="card-panel toolbar">\s*<div class="items-view-switch seg" id="items-view-switch" role="group" aria-label="Items view"><\/div>\s*<div class="filter-control"><button class="filter-toggle" id="filter-toggle"/, 'the view toggle and filter are together in the toolbar');+ assert.doesNotMatch(page.html, /id="lane-pick"|id="state-chips"/, 'the old second-row controls are gone');assert.match(page.html, /<header class="top">[^]*<div class="top-find"><input id="q" type="search"[^]*<\/header>/, 'and the search is in the top bar');assert.doesNotMatch(page.html, /id="lane-filter"|class="chips" id="state-chips"/, 'no lane menu and no row of chips');@@ -335,6 +336,156 @@ test('the list shows active, verified or all [N26]', async () => {await view.stop();}});++test('the items toolbar is one row: view, filter and new [N26]', async () => {+ const executable = chromeExecutable();+ assert.ok(executable, 'the required real-Chrome toolbar check needs Chrome');+ const box = machine();+ const longLane = 'apilonglanenameforclipping';+ const lanes = { web: { owns: ['web/'], specs: ['G'] }, [longLane]: { owns: ['api/'], specs: ['G'] } };+ const alpha = project(box, 'toolbar', SPEC, { lanes });+ box.run(alpha.repo, 'add', 'web', 'Active item', '--specs', 'G1');+ box.run(alpha.repo, 'add', longLane, 'Another item', '--specs', 'G1');+ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-items-toolbar-chrome-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor("document.querySelectorAll('#chain .row').length === 2");+ for (const width of [375, 1280]) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });+ await chrome.waitFor(`innerWidth === ${width}`);+ for (const scheme of ['light', 'dark']) {+ await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: scheme }] });+ await chrome.waitFor(`document.documentElement.dataset.scheme === '${scheme}'`);+ await press(chrome, "document.querySelector('#filter-toggle')");+ await chrome.waitFor("!document.querySelector('#filter-menu').hidden");+ const layout = JSON.parse(await chrome.stable(`JSON.stringify((() => {+ const toolbar = document.querySelector('.toolbar'), nodes = [...toolbar.children];+ const rect = node => { const r = node.getBoundingClientRect(); return { top:r.top, bottom:r.bottom, height:r.height, left:r.left, right:r.right }; };+ const menu = rect(document.querySelector('#filter-menu'));+ return { children:nodes.map(node => node.id || node.className), rows:nodes.map(rect), scroll:toolbar.scrollWidth,+ client:toolbar.clientWidth, page:document.documentElement.scrollWidth, width:innerWidth,+ menu,+ buttons:[...toolbar.querySelectorAll('button')].map(node => ({ text:node.innerText, name:node.getAttribute('aria-label'), height:rect(node).height })),+ groups:[...document.querySelectorAll('#filter-menu .filter-group')].map(group => group.getAttribute('aria-label')) };+ })())`));+ assert.deepEqual(layout.children, ['items-view-switch', 'filter-control', 'new-item'], `${width}/${scheme}: exactly the three toolbar controls appear in order`);+ // One row: the controls share a centre line (List | Pipeline is a 48px group around 44px buttons, so tops differ).+ const centres = layout.rows.map(row => (row.top + row.bottom) / 2);+ assert.ok(Math.max(...centres) - Math.min(...centres) <= 2, `${width}/${scheme}: controls share one row: ${JSON.stringify(layout)}`);+ assert.ok(layout.scroll <= layout.client && layout.page <= width, `${width}/${scheme}: no horizontal toolbar or page scroll: ${JSON.stringify(layout)}`);+ assert.ok(layout.menu.left >= 0 && layout.menu.right <= width, `${width}/${scheme}: the long-lane menu stays within the viewport: ${JSON.stringify(layout.menu)}`);+ assert.deepEqual(layout.groups, ['Show', 'Lane'], `${width}/${scheme}: the open filter has both groups`);+ assert.deepEqual(layout.buttons.slice(0, 2).map(button => button.text), ['List', 'Pipeline'], `${width}/${scheme}: List and Pipeline lead the row`);+ assert.ok(layout.buttons.every(button => button.height >= tapTarget(width)), `${width}/${scheme}: toolbar buttons meet the ${tapTarget(width)}px target: ${JSON.stringify(layout.buttons)}`);+ assert.equal(layout.buttons.at(-1).name, 'New item', `${width}/${scheme}: the new action keeps its accessible name`);+ assert.equal(layout.buttons.at(-1).text, width < 900 ? 'New' : 'New item', `${width}/${scheme}: the new action uses the right visible label`);+ if (process.env.PULLBOARD_ITEMS_TOOLBAR_PROOF) {+ mkdirSync(process.env.PULLBOARD_ITEMS_TOOLBAR_PROOF, { recursive: true });+ const shot = await chrome.send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true });+ writeFileSync(join(process.env.PULLBOARD_ITEMS_TOOLBAR_PROOF, `toolbar-${width}-${scheme}.png`), Buffer.from(shot.data, 'base64'));+ }+ await press(chrome, "document.querySelector('#detail')");+ await chrome.waitFor("document.querySelector('#filter-menu').hidden");+ }+ }+ await press(chrome, "document.querySelector('#new-item')");+ await chrome.waitFor("!document.querySelector('#add-form').hidden");+ await press(chrome, "document.querySelector('#add-cancel')");+ await chrome.waitFor("document.querySelector('#add-form').hidden");+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+});++test('the filter menu sets show and lane [N26]', async () => {+ const executable = chromeExecutable();+ assert.ok(executable, 'the required real-Chrome filter check needs Chrome');+ const box = machine();+ const lanes = { web: { owns: ['web/'], specs: ['G'] }, api: { owns: ['api/'], specs: ['G'] } };+ const alpha = project(box, 'filter', SPEC, { lanes });+ box.run(alpha.repo, 'add', 'web', 'Active item', '--specs', 'G1');+ box.run(alpha.repo, 'add', 'api', 'Verified item', '--specs', 'G1');+ const api = join(box.dir, 'filter-api');+ const apiBranch = 'api/filter';+ box.git(alpha.repo, 'worktree', 'add', '-q', api, '-b', apiBranch);+ box.run(api, 'join', 'api');+ box.run(api, 'claim', '2');+ mkdirSync(join(api, 'api'), { recursive: true });+ writeFileSync(join(api, 'api', 'verified.html'), 'verified.html\n');+ box.git(api, 'add', '-A');+ box.git(api, 'commit', '-q', '-m', 'feat(api): verified [G1]');+ box.run(api, 'submit', '2');+ box.git(alpha.repo, 'switch', '-q', '--detach', apiBranch);+ box.run(alpha.repo, 'verify', '2', 'accept', '--note', 'the page shows it', '--as', 'coordinator');+ box.git(alpha.repo, 'switch', '-q', 'main');+ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-items-filter-chrome-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor("document.querySelectorAll('#chain .row').length === 1");+ assert.equal(await chrome.stable("document.querySelector('#chain .row').dataset.item"), '1');+ await press(chrome, "document.querySelector('#filter-toggle')");+ await chrome.waitFor("!document.querySelector('#filter-menu').hidden");+ assert.deepEqual(JSON.parse(await chrome.stable("JSON.stringify([...document.querySelectorAll('#filter-menu .filter-option[data-filter-kind=state]')].map(option => option.querySelector('.filter-option-label').textContent + ' ' + option.querySelector('b').textContent))")), ['Active 1', 'Verified 1', 'All 2'], 'Show choices name their counts');+ await press(chrome, "document.querySelector('#filter-menu [data-state=verified]')");+ await chrome.waitFor("view.state === 'verified' && document.querySelector('#filter-menu').hidden");+ assert.equal(await chrome.stable("document.querySelector('#chain .row').dataset.item"), '2', 'choosing Verified updates the list at once');+ assert.equal(await chrome.stable("document.querySelector('#filter-toggle').textContent"), 'Filter: Verified');+ await press(chrome, "document.querySelector('#filter-toggle')");+ assert.equal(await chrome.stable("document.querySelector('#filter-menu .filter-option[data-filter-kind=lane][data-filter-value=api]').getAttribute('aria-label')"), 'api · 1');+ await press(chrome, "document.querySelector('#filter-menu .filter-option[data-filter-kind=lane][data-filter-value=api]')");+ await chrome.waitFor("view.lane === 'api' && document.querySelector('#filter-menu').hidden");+ assert.equal(await chrome.stable("document.querySelector('#filter-toggle').textContent"), 'Filter: Verified · api', 'mouse can choose a lane');+ await press(chrome, "document.querySelector('#filter-toggle')");+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'ArrowDown', code: 'ArrowDown', windowsVirtualKeyCode: 40 });+ for (let step = 0; step < 1; step += 1) {+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'ArrowDown', code: 'ArrowDown', windowsVirtualKeyCode: 40 });+ }+ await chrome.waitFor("document.activeElement.dataset.filterChoice === 'state:verified'");+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, ...(type === 'keyDown' ? { text: '\r' } : {}) });+ await chrome.waitFor("view.state === 'verified' && document.querySelector('#filter-menu').hidden");+ await press(chrome, "document.querySelector('#filter-toggle')");+ for (let step = 0; step < 5; step += 1) {+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'ArrowDown', code: 'ArrowDown', windowsVirtualKeyCode: 40 });+ }+ await chrome.waitFor("document.activeElement.dataset.filterChoice === 'lane:api'");+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, ...(type === 'keyDown' ? { text: '\r' } : {}) });+ await chrome.waitFor("view.lane === 'api' && document.querySelector('#filter-menu').hidden");+ assert.equal(await chrome.stable("document.querySelector('#chain .row').dataset.item"), '2', 'choosing a lane from the keyboard applies it immediately');+ assert.equal(await chrome.stable("document.querySelector('#filter-toggle').textContent"), 'Filter: Verified · api');+ await press(chrome, "document.querySelector('#filter-toggle')");+ assert.equal(await chrome.stable("document.querySelector('#filter-menu [data-filter-kind=state][data-filter-value=verified]').getAttribute('aria-checked')"), 'true', 'the selected Show option is marked');+ assert.equal(await chrome.stable("document.querySelector('#filter-menu [data-filter-value=api]')?.getAttribute('aria-checked')"), 'true', 'the selected Lane option is marked');+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'Escape', code: 'Escape', windowsVirtualKeyCode: 27 });+ await chrome.waitFor("document.querySelector('#filter-menu').hidden");+ assert.equal(await chrome.stable("view.state + ':' + view.lane + ':' + document.querySelector('#filter-toggle').textContent"), 'verified:api:Filter: Verified · api', 'Escape closes without changing either choice');+ await press(chrome, "document.querySelector('#filter-toggle')");+ await press(chrome, "document.querySelector('[data-items-view=pipeline]')");+ await chrome.waitFor("view.itemsView === 'pipeline'");+ await press(chrome, "document.querySelector('#filter-toggle')");+ assert.equal(await chrome.stable("document.querySelectorAll('#filter-menu .filter-group').length"), 1, 'Pipeline omits Show');+ assert.equal(await chrome.stable("document.querySelector('#filter-menu .filter-group').getAttribute('aria-label')"), 'Lane');+ await press(chrome, "document.querySelector('#filter-menu .filter-option[data-filter-kind=lane][data-filter-value=web]')");+ await chrome.waitFor("view.lane === 'web' && document.querySelector('#filter-menu').hidden");+ assert.deepEqual(JSON.parse(await chrome.stable("JSON.stringify([...document.querySelectorAll('#pipeline .pipeline-item')].map(item => item.dataset.item))")), ['1'], 'the Lane choice still filters Pipeline');+ await press(chrome, "document.querySelector('[data-items-view=list]')");+ await chrome.waitFor("view.itemsView === 'list'");+ await press(chrome, "document.querySelector('#filter-toggle')");+ await press(chrome, "document.querySelector('#detail')");+ await chrome.waitFor("document.querySelector('#filter-menu').hidden");+ assert.equal(await chrome.stable("view.state + ':' + view.lane"), 'verified:web', 'an outside click closes without changing either choice');+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+});+test('shout ids, search and narrow windows reach the item [N26]', async () => {const box = machine();const p = project(box, 'desk');@@ -355,9 +506,9 @@ test('shout ids, search and narrow windows reach the item [N26]', async () => {assert.doesNotMatch(page.show('chain'), /Farewell banner/, 'Active hides the verified item');await page.type('q', 'farewell');assert.match(page.show('chain'), /Farewell banner/, 'a search finds the verified item');- assert.match(page.show('state-chips'), /data-state="all" class="on"/, 'and says it looks in every state');- assert.match(page.show('state-chips'), /Verified<b>1<\/b>/);- assert.match(page.show('state-chips'), /Active<b>0<\/b>/, 'the chips count the matches');+ assert.match(page.show('filter-menu'), /aria-checked="true" data-filter-choice="state:all"/, 'and marks the all-state choice');+ assert.match(page.show('filter-menu'), /<span class="filter-option-label">Verified<\/span><b>1<\/b>/);+ assert.match(page.show('filter-menu'), /<span class="filter-option-label">Active<\/span><b>0<\/b>/, 'the menu counts the matches');await page.type('q', '');assert.equal(page.run('view.state'), 'active', 'clearing the search brings the chip back');assert.doesNotMatch(page.show('chain'), /Farewell banner/);@@ -377,8 +528,8 @@ test('shout ids, search and narrow windows reach the item [N26]', async () => {const found = itemRow(page.show('chain'), 40);assert.match(found, /Retired widget/, 'a search finds the withdrawn item too');assert.match(found, /<span class="chip ">withdrawn<\/span>/);- assert.match(page.show('state-chips'), /All<b>1<\/b>/);- assert.match(page.show('state-chips'), /Active<b>0<\/b>/, 'a withdrawn item is not active');+ assert.match(page.show('filter-menu'), /<span class="filter-option-label">All<\/span><b>1<\/b>/);+ assert.match(page.show('filter-menu'), /<span class="filter-option-label">Active<\/span><b>0<\/b>/, 'a withdrawn item is not active');await page.type('q', '');const feed = page.show('feed');@@ -671,7 +822,7 @@ test('in-text item references stay inline and open their target at phone and desfor (const width of [375, 1280]) {await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });// Needs you heads the Items list under Active; the steps below leave other tabs and filters open.- await chrome.click("document.querySelector('[data-tab=items]')"); await chrome.click("document.querySelector('[data-state=active]')");+ await chrome.click("document.querySelector('[data-tab=items]')"); await chooseFilter(chrome, 'state:active');// The row inlineReference stays on its title line beside the text.const rendered = JSON.parse(await chrome.stable(`JSON.stringify((() => {const row = document.querySelector('#chain .row[data-item="2"]');@@ -746,7 +897,7 @@ test('in-text item references stay inline and open their target at phone and desawait chrome.click(`document.querySelector('[data-tab="items"]')`);await chrome.click(`document.querySelector('#chain .row[data-item="2"] .t button.ref')`);await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");- await chrome.click("document.querySelector('[data-state=active]')");+ await chooseFilter(chrome, 'state:active');await chrome.click(`document.querySelector('#needs .row .t button.ref')`);await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");diff --git a/test/cockpit/layout.test.js b/test/cockpit/layout.test.jsindex 60ddd25f..2a7e772e 100644--- a/test/cockpit/layout.test.js+++ b/test/cockpit/layout.test.js@@ -285,9 +285,9 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000bar: [...document.querySelectorAll('.status [data-status]')].filter((part) => !part.hidden).map((part) => ({ to: part.dataset.status, text: part.textContent.replace(/\\s+/g, ' ').trim(), height: part.getBoundingClientRect().height })),barShown: getComputedStyle(status).display !== 'none', barBox: box(status), barTint: rgb(getComputedStyle(status).backgroundColor), barBlur: getComputedStyle(status).backdropFilter,rows, warn, state: view.state, lane: view.lane, tab: view.tab,- chips: [...document.querySelectorAll('#state-chips button')].map((chip) => [chip.firstChild.textContent, chip.querySelector('b').textContent, chip.classList.contains('on')]),- lanes: [...document.querySelectorAll('#lane-pick option')].map((option) => option.textContent), pick: box(document.querySelector('#lane-pick')),- seg: box(document.querySelector('#state-chips')), go: box(document.querySelector('#new-item')), toolbar: box(document.querySelector('.toolbar')),+ chips: [...document.querySelectorAll('[data-filter-kind="state"]')].map((choice) => [choice.dataset.state, choice.querySelector('b').textContent, choice.getAttribute('aria-checked') === 'true']),+ lanes: [...document.querySelectorAll('[data-filter-kind="lane"]')].map((choice) => choice.querySelector('.filter-option-label').textContent + (choice.querySelector('b') ? ' · ' + choice.querySelector('b').textContent : '')), pick: box(document.querySelector('#filter-toggle')),+ seg: box(document.querySelector('.items-view-switch')), go: box(document.querySelector('#new-item')), toolbar: box(document.querySelector('.toolbar')),waiting: (() => { const fold = document.querySelector('.asks-toggle[data-fold="waiting"]'); return fold && { text: fold.textContent.replace(/\\s+/g, ' ').trim(), open: fold.getAttribute('aria-expanded'), height: fold.getBoundingClientRect().height, offset: fold.getBoundingClientRect().top - fold.closest('.shouts-card').getBoundingClientRect().top, cards: document.querySelectorAll('#decisions .shout').length }; })(),idle: (() => { const fold = document.querySelector('#agents .fold-line[data-fold="idle"]'); return fold && { text: words(fold), open: fold.getAttribute('aria-expanded'), height: fold.getBoundingClientRect().height, pills: document.querySelectorAll('#agents .agent-pill').length }; })(),agentRows: [...document.querySelectorAll('#agents .agent-card')].filter((card) => card.getBoundingClientRect().height > 0).length,@@ -297,8 +297,10 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000const number = (p) => Number(/^(\d+)/.exec(p?.text ?? '')?.[1] ?? NaN);const click = async (selector) => chrome.click(`document.querySelector(${JSON.stringify(selector)})`);const settle = () => chrome.stable('new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done)))');- /** Pick a lane the way the picker does: its value, then its change event. */- const lane = async (name) => { await chrome.stable(`(() => { const pick = document.querySelector('#lane-pick'); pick.value = ${JSON.stringify(name)}; pick.dispatchEvent(new Event('change')); })()`); await settle(); };+ /** Choose a filter through the real menu. */+ const filter = async (kind, value) => { await click('#filter-toggle'); await click(`[data-filter-choice="${kind}:${value}"]`); await settle(); };+ /** Choose a lane through the filter menu. */+ const lane = async (name) => filter('lane', name);try {chrome = await openSnapshotChrome(executable, view.link.href, profile);await chrome.waitFor("typeof data === 'object' && data?.project?.items?.length === 7 && !!document.querySelector('.status [data-status=\"items\"]')");@@ -309,7 +311,7 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000await chrome.waitFor(`innerWidth === ${width} && matchMedia('(prefers-color-scheme: ${scheme})').matches`);await click('[data-tab=items]');await click('[data-tab=items]');- await click('[data-state=active]');+ await filter('state', 'active');await settle();const at = `${width}px ${scheme}`;const r = await read();@@ -350,12 +352,13 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000const [gr, gg, gb] = row['5'].border;assert.ok(row['5'].edges && gr > gb + 30 && gg > gb + 20, `${at}: in dark it has a gold outline too: ${row['5'].border}`);}- // The toolbar is the states, the lane picker and New item on one line; on a phone, as the person chose (#368), the- // states and New item, with the lane picker dropped.- assert.deepEqual(r.lanes, ['All lanes', 'web · 5', 'api · 1'], `${at}: each lane with its count under Active`);+ // The view toggle, Filter and New item stay on one line at both widths.+ await click('#filter-toggle');+ const menu = await read();+ assert.deepEqual(menu.lanes, ['All lanes', 'web · 5', 'api · 1'], `${at}: each lane with its count under Active`);+ await click('#filter-toggle');const centre = (b) => b.top + b.height / 2;- if (width === 1280) assert.ok(Math.abs(centre(r.seg) - centre(r.pick)) <= 4 && Math.abs(centre(r.pick) - centre(r.go)) <= 4, `${at}: one line: ${JSON.stringify([r.seg, r.pick, r.go])}`);- else assert.ok(r.pick.width === 0 && Math.abs(centre(r.seg) - centre(r.go)) <= 4, `${at}: the states and New item on one line, no lane picker: ${JSON.stringify([r.seg, r.pick, r.go, r.toolbar])}`);+ assert.ok(Math.abs(centre(r.seg) - centre(r.pick)) <= 4 && Math.abs(centre(r.pick) - centre(r.go)) <= 4, `${at}: one line: ${JSON.stringify([r.seg, r.pick, r.go])}`);}}@@ -364,7 +367,7 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: 'light' }] });await chrome.waitFor('innerWidth === 1280');await click('[data-tab=items]');- await click('[data-state=all]');+ await filter('state', 'all');let r = await read();for (const [to, state, label] of [['verify', 'verify', 'To verify'], ['gated', 'gated', 'Gated'], ['items', 'active', 'Active']]) {const n = number(part(r, to));@@ -372,12 +375,15 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000await chrome.waitFor(`view.tab === 'items' && view.state === '${state}'`);await settle();r = await read();+ await click('#filter-toggle');+ r = await read();const on = r.chips.find(([, , isOn]) => isOn);- assert.deepEqual([on?.[0], Number(on?.[1]), r.rows.length], [label, n, n], `${to}: the bar's ${n} opens ${label}, which counts and lists the same ${n}: ${JSON.stringify(r.chips)}`);+ assert.deepEqual([on?.[0], Number(on?.[1]), r.rows.length], [state, n, n], `${to}: the bar's ${n} opens ${label}, which counts and lists the same ${n}: ${JSON.stringify(r.chips)}`);+ await click('#filter-toggle');if (to === 'gated') assert.ok(r.rows.every((x) => x.gated), 'every row it opens is a gated row');}await click('[data-tab=items]');- await click('[data-state=active]');+ await filter('state', 'active');await click('.status [data-status="agents"]');await chrome.waitFor("view.tab === 'shouts' && !document.querySelector('[data-pane=shouts]').hidden");r = await read();@@ -406,19 +412,25 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000// Lanes narrow the list as states do, each counting within the other's choice.await click('[data-tab=items]');- await click('[data-state=active]');+ await filter('state', 'active');await lane('api');r = await read();- assert.deepEqual([r.lane, r.rows.map((x) => x.id), r.chips.find(([name]) => name === 'Active')[1], r.chips.find(([name]) => name === 'Verified')[1]], ['api', ['4'], '1', '0'], 'api narrows the list and the state counts');+ await click('#filter-toggle');+ r = await read();+ assert.deepEqual([r.lane, r.rows.map((x) => x.id), r.chips.find(([name]) => name === 'active')[1], r.chips.find(([name]) => name === 'verified')[1]], ['api', ['4'], '1', '0'], 'api narrows the list and the state counts');+ await click('#filter-toggle');await lane('');await click('[data-tab=items]');- await click('[data-state=verified]');+ await filter('state', 'verified');await lane('web');r = await read();+ await click('#filter-toggle');+ r = await read();assert.deepEqual([r.lane, r.rows.map((x) => x.id), r.lanes], ['web', ['7'], ['All lanes', 'web · 1']], 'under Verified the lanes count what is verified');+ await click('#filter-toggle');await lane('');await click('[data-tab=items]');- await click('[data-state=active]');+ await filter('state', 'active');// Shouts: asks waiting on others and idle agents each fold to one line, closed until opened.await click('[data-tab=shouts]');@@ -624,7 +636,7 @@ test('targets are 44px for touch and compact under a mouse [N26]', { timeout: 15tap: getComputedStyle(document.documentElement).getPropertyValue('--tap').trim(), coarse: matchMedia('(pointer: coarse)').matches,short: controls.filter((c) => c.height < 44 && !c.inline), count: controls.length,exempt: controls.filter((c) => c.named).map((c) => ({ text: c.text, height: Math.round(c.height), inLine: c.inLine })), standalone: inLine(document.querySelector('#new-item')),- toolbar: { states: [...document.querySelectorAll('#state-chips button')].filter(visible).map((b) => Math.round(b.getBoundingClientRect().height)), lane: height('#lane-pick'), go: height('#new-item') },+ toolbar: { views: [...document.querySelectorAll('.items-view-switch button')].filter(visible).map((b) => Math.round(b.getBoundingClientRect().height)), filter: height('#filter-toggle'), go: height('#new-item') },composer: { text: height('#shout-text'), send: height('#shout-send') }, status: [...document.querySelectorAll('.status [data-status]')].filter(visible).map((b) => Math.round(b.getBoundingClientRect().height)),};})())`));@@ -654,7 +666,7 @@ test('targets are 44px for touch and compact under a mouse [N26]', { timeout: 15} else {// Under a mouse on a wide screen controls size to their words: the Items toolbar at 32px, the composer one line.assert.equal(items.tap, '32px', `${at}: the target is 32px under a mouse`);- assert.ok(items.toolbar.states.length === 3 && [...items.toolbar.states, items.toolbar.lane, items.toolbar.go].every((h) => Math.abs(h - 32) <= 1), `${at}: the Items toolbar's controls are 32px: ${JSON.stringify(items.toolbar)}`);+ assert.ok(items.toolbar.views.length === 2 && [...items.toolbar.views, items.toolbar.filter, items.toolbar.go].every((h) => Math.abs(h - 32) <= 1), `${at}: the Items toolbar's controls are 32px: ${JSON.stringify(items.toolbar)}`);assert.ok(shouts.composer.text <= 34 && Math.abs(shouts.composer.send - 32) <= 1, `${at}: the composer is one line of text: ${JSON.stringify(shouts.composer)}`);assert.ok(items.status.length > 0 && items.status.every((h) => h <= 30), `${at}: the status bar keeps its thin strip, no exception needed: ${JSON.stringify(items.status)}`);assert.ok(items.short.length > 0, `${at}: there is no blanket 44px minimum under a mouse`);diff --git a/test/cockpit/needs.test.js b/test/cockpit/needs.test.jsindex b94d7d4f..c0763f86 100644--- a/test/cockpit/needs.test.js+++ b/test/cockpit/needs.test.js@@ -4,7 +4,7 @@ import { mkdtempSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { test } from 'node:test';-import { SPEC, machine, project, build, sendBack, startView, styleOf, element, openPage, projectRows, agentEntries, needEntries, itemRow, shoutNameText, chromeExecutable, openSnapshotChrome, closeSnapshotChrome } from './fixture.js';+import { SPEC, machine, project, build, sendBack, startView, styleOf, element, openPage, projectRows, agentEntries, needEntries, itemRow, shoutNameText, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, chooseFilter } from './fixture.js';test('a decision waits in needs-you until the view answers it [B21, B26, N27]', async () => {@@ -215,7 +215,7 @@ test('needs you and the asks sit in their lists [N26]', { timeout: 180_000 }, asconst at = `${width}px ${scheme}`;await click('[data-tab=items]');await click('[data-tab=items]');- await click('[data-state=active]');+ await chooseFilter(chrome, 'state:active');let r = await read();assert.ok(r.page.scroll <= r.page.width && r.page.body <= r.page.width, `${at}: no sideways scroll on Items`);// Needs you heads the list: each call a row shaped like an item, NEEDS YOU and its kind (for a decision, who@@ -285,10 +285,10 @@ test('needs you and the asks sit in their lists [N26]', { timeout: 180_000 }, asassert.equal((await read()).feedBar, false, 'show all brings back every shout and clears the bar');// Under Verified, or a lane, the list is narrowed and Needs you steps aside.await click('[data-tab=items]');- await click('[data-state=verified]');+ await chooseFilter(chrome, 'state:verified');assert.equal((await read()).needsShown, false, 'under Verified, Needs you steps aside');await click('[data-tab=items]');- await click('[data-state=active]');+ await chooseFilter(chrome, 'state:active');assert.deepEqual(chrome.exceptions, [], 'the page raises no uncaught exception');} finally {if (chrome) await closeSnapshotChrome(chrome);diff --git a/test/cockpit/roadmap.test.js b/test/cockpit/roadmap.test.jsindex 7094d68c..9376f607 100644--- a/test/cockpit/roadmap.test.js+++ b/test/cockpit/roadmap.test.js@@ -4,7 +4,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { test } from 'node:test';-import { tapTarget, SPEC, machine, project, build, sendBack, fetchLive, startView, target, accept, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, press, travel, pressedInto, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, tabBar, proofShot, pickProject } from './fixture.js';+import { tapTarget, SPEC, machine, project, build, sendBack, fetchLive, startView, target, accept, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, press, travel, pressedInto, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, tabBar, proofShot, pickProject, chooseFilter } from './fixture.js';test('Roadmap and rule prose references stay inline and open the item on their own board [N26,N38]', { timeout: 90_000 }, async (t) => {@@ -67,7 +67,7 @@ test('Roadmap and rule prose references stay inline and open the item on their oassert.equal(await chrome.stable("document.querySelectorAll('#detail .verdict .note .ref').length"), 1, 'verdict prose keeps its item reference');await chrome.click("document.querySelector('#detail .verdict .note .ref')");await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Local target')");- await chrome.click("document.querySelector('[data-state=active]')");+ await chooseFilter(chrome, 'state:active');await chrome.click("document.querySelector('#needs .row[data-go^=\"decide:\"]')");assert.equal(await chrome.stable("document.querySelectorAll('#answering-q .ref').length"), 1, 'the answering question keeps its inline item reference');await chrome.click("document.querySelector('#answering-q .ref')");diff --git a/test/cockpit/search.test.js b/test/cockpit/search.test.jsindex 606bcae2..f7fd5dd9 100644--- a/test/cockpit/search.test.js+++ b/test/cockpit/search.test.js@@ -109,10 +109,11 @@ test('search in the top bar finds anything on the board [N26]', { timeout: 150_0const results = document.querySelector('#find-results');return {page: { width: document.documentElement.clientWidth, scroll: document.documentElement.scrollWidth, body: document.body.scrollWidth },- inTop: !!document.querySelector('.top .top-find #q'), toolbar: [...document.querySelector('.toolbar').children].filter((e) => e.offsetParent !== null || e.tagName === 'SELECT').map((e) => e.id || e.className),+ inTop: !!document.querySelector('.top .top-find #q'), toolbar: [...document.querySelector('.toolbar').children].filter((e) => e.offsetParent !== null).map((e) => e.id || e.className),field: box(document.querySelector('#q')), tabs: box(document.querySelector('#tabs')), top: box(document.querySelector('header.top')), theme: box(document.querySelector('#theme')),- bar: [...document.querySelectorAll('.toolbar #state-chips button, .toolbar #lane-pick, .toolbar #new-item')].filter((e) => e.getClientRects().length > 0)- .map((e) => ({ name: e.dataset.state || e.id, on: e.classList.contains('on'), middle: Math.round(e.getBoundingClientRect().top + e.getBoundingClientRect().height / 2) })),+ bar: [...document.querySelectorAll('.toolbar .items-view-switch button, .toolbar #filter-toggle, .toolbar #new-item')].filter((e) => e.getClientRects().length > 0)+ .map((e) => ({ name: e.dataset.itemsView || e.id, on: e.getAttribute('aria-pressed') === 'true', middle: Math.round(e.getBoundingClientRect().top + e.getBoundingClientRect().height / 2) })),+ filterLabel: document.querySelector('#filter-toggle').textContent,shoutIds: data.project.shouts.map((x) => '#' + x.shout_id), focused: document.activeElement?.id ?? null, value: document.querySelector('#q').value,shown: !results.hidden, groups: [...results.querySelectorAll('h4')].map((h) => [h.firstChild.textContent, h.querySelector('span').textContent]),hits: [...results.querySelectorAll('.find-hit')].map((hit) => ({ go: hit.dataset.find, id: hit.querySelector('code').textContent, note: hit.querySelector('small').textContent, on: hit.classList.contains('on') })),@@ -125,6 +126,11 @@ test('search in the top bar finds anything on the board [N26]', { timeout: 150_0const tap = async (selector) => {await press(chrome, `document.querySelector(${JSON.stringify(selector)})`);};+ /** Select a menu choice through the browser's input path. */+ const chooseFilter = async (kind, value) => {+ await tap('#filter-toggle');+ await tap(`[data-filter-choice="${kind}:${value}"]`);+ };const search = (words) => searchFor(chrome, words);try {chrome = await openSnapshotChrome(executable, view.link.href, profile);@@ -136,18 +142,16 @@ test('search in the top bar finds anything on the board [N26]', { timeout: 150_0await chrome.waitFor(`innerWidth === ${width} && matchMedia('(prefers-color-scheme: ${scheme})').matches`);await chrome.click("document.querySelector('[data-tab=items]')");const at = `${width}px ${scheme}`;- // The Items toolbar is one row: Active, Verified and All, the lane picker, New item at its end; on a phone Active- // and Verified with New item, All and the lane picker dropped.+ // The Items toolbar is one row: view toggle, Filter and New item.const bar = (await read()).bar, names = bar.map((part) => part.name);- if (width === 375) assert.deepEqual(names, ['active', 'verified', 'new-item'], `${at}: on a phone the toolbar is Active, Verified and New item`);- else assert.deepEqual([names.slice(0, 3), names.at(-1)], [['active', 'verified', 'all'], 'new-item'], `${at}: the toolbar's states, then New item at its end`);+ assert.deepEqual(names, ['list', 'pipeline', 'filter-toggle', 'new-item'], `${at}: view toggle, Filter and New item share the toolbar`);assert.ok(bar.every((part) => Math.abs(part.middle - bar[0].middle) <= 2), `${at}: the toolbar is one row: ${JSON.stringify(bar)}`);await search('greeting');const r = await read();assert.ok(r.page.scroll <= r.page.width && r.page.body <= r.page.width, `${at}: no sideways scroll`);- // The search is the top bar's; the Items toolbar keeps the states, the lane picker and New item.+ // The search is the top bar's; the Items toolbar keeps its view, filter and New item controls.assert.ok(r.inTop, `${at}: the search sits in the top bar`);- assert.deepEqual(r.toolbar, ['state-chips', 'lane-pick', 'new-item'], `${at}: the Items toolbar has no search field`);+ assert.deepEqual(r.toolbar, ['items-view-switch', 'filter-control', 'new-item'], `${at}: the Items toolbar has no search field`);if (width === 375) assert.ok(r.field.top >= r.tabs.bottom - 1 && r.field.width >= r.page.width - 40, `${at}: on a phone the search is its own row under the tabs: ${JSON.stringify([r.field, r.tabs])}`);else assert.ok(Math.abs((r.field.top + r.field.height / 2) - (r.top.top + r.top.height / 2)) <= 2 && r.field.left >= r.tabs.right && r.field.right <= r.theme.left, `${at}: the search sits in the top bar between the tabs and the theme button: ${JSON.stringify([r.tabs, r.field, r.theme, r.top])}`);// Results group by kind, five a group with how many there are, the first ready for Enter.@@ -189,8 +193,7 @@ test('search in the top bar finds anything on the board [N26]', { timeout: 150_0await key('Enter', 'Enter', 13, '\r');await chrome.waitFor(`view.tab === 'items' && view.item === ${Number(third.slice(5))} && document.querySelector('#find-results').hidden`);- // On a phone, a search that opens an item shows All, since All is then the selected filter, so the person sees where- // they are and can leave it; Active again drops All.+ // On a phone, a search that opens an item names the selected All filter, which can be changed back to Active.for (const scheme of ['light', 'dark']) {await chrome.send('Emulation.setDeviceMetricsOverride', { width: 375, height: 900, deviceScaleFactor: 1, mobile: false });await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: scheme }] });@@ -198,11 +201,12 @@ test('search in the top bar finds anything on the board [N26]', { timeout: 150_0await search('greeting');await key('Enter', 'Enter', 13, '\r');await chrome.waitFor("view.tab === 'items' && !!view.item && document.querySelector('#find-results').hidden");- const opened = (await read()).bar;- assert.deepEqual(opened.map((part) => [part.name, part.on]), [['active', false], ['verified', false], ['all', true], ['new-item', false]], `375px ${scheme}: a search that opens an item shows All, selected: ${JSON.stringify(opened)}`);- assert.ok(opened.every((part) => Math.abs(part.middle - opened[0].middle) <= 2), `375px ${scheme}: still one row: ${JSON.stringify(opened)}`);- await chrome.click("document.querySelector('[data-state=active]')");- assert.deepEqual((await read()).bar.map((part) => part.name), ['active', 'verified', 'new-item'], `375px ${scheme}: back on Active, All drops again`);+ const opened = await read();+ assert.equal(opened.filterLabel, 'Filter: All', `375px ${scheme}: a search that opens an item names All`);+ assert.deepEqual(opened.bar.map((part) => part.name), ['list', 'pipeline', 'filter-toggle', 'new-item'], `375px ${scheme}: the toolbar retains its controls: ${JSON.stringify(opened.bar)}`);+ assert.ok(opened.bar.every((part) => Math.abs(part.middle - opened.bar[0].middle) <= 2), `375px ${scheme}: still one row: ${JSON.stringify(opened)}`);+ await chooseFilter('state', 'active');+ assert.equal((await read()).filterLabel, 'Filter', `375px ${scheme}: back on Active, All is cleared`);}await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: 'light' }] });@@ -250,40 +254,44 @@ test('search in the top bar finds anything on the board [N26]', { timeout: 150_0// it; with every lane shown it drops again. A coordinator item makes a second lane to pick between.box.run(alpha.repo, 'add', 'coordinator', 'Plan the greeting release', '--criterion', 'planned');await chrome.waitFor('data.project.items.length === 9', 15_000);- const lane = (name) => chrome.stable(`(() => { const pick = document.querySelector('#lane-pick'); pick.value = ${JSON.stringify(name)}; pick.dispatchEvent(new Event('change', { bubbles: true })); })()`);+ /** Pick a lane through the visible filter menu. */+ const lane = async (name) => {+ await press(chrome, "document.querySelector('#filter-toggle')");+ await press(chrome, `document.querySelector('[data-filter-choice="lane:${name}"]')`);+ };for (const scheme of ['light', 'dark']) {await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: scheme }] });await chrome.waitFor(`innerWidth === 1280 && matchMedia('(prefers-color-scheme: ${scheme})').matches`);- await chrome.click("document.querySelector('[data-tab=items]')"); await chrome.click("document.querySelector('[data-state=active]')");+ await chrome.click("document.querySelector('[data-tab=items]')"); await chooseFilter('state', 'active');await lane('web');await chrome.waitFor("view.lane === 'web'");- assert.ok((await read()).bar.some((part) => part.name === 'lane-pick'), `1280px ${scheme}: the lane picker is in the toolbar`);+ assert.equal((await read()).filterLabel, 'Filter: web', `1280px ${scheme}: the selected lane is named by Filter`);await chrome.send('Emulation.setDeviceMetricsOverride', { width: 375, height: 900, deviceScaleFactor: 1, mobile: false });await chrome.waitFor('innerWidth === 375');const narrowed = await read();- assert.deepEqual(narrowed.bar.map((part) => part.name), ['active', 'verified', 'lane-pick', 'new-item'], `375px ${scheme}: a picked lane keeps its picker: ${JSON.stringify(narrowed.bar)}`);+ assert.deepEqual(narrowed.bar.map((part) => part.name), ['list', 'pipeline', 'filter-toggle', 'new-item'], `375px ${scheme}: a picked lane keeps all toolbar controls: ${JSON.stringify(narrowed.bar)}`);assert.ok(narrowed.bar.every((part) => Math.abs(part.middle - narrowed.bar[0].middle) <= 2) && narrowed.page.scroll <= narrowed.page.width, `375px ${scheme}: still one row, no sideways scroll: ${JSON.stringify(narrowed)}`);- // With the lane still picked, a search that opens an item makes All the selected filter too: both filters show,- // New item is a + that is still named New item, and the row holds.+ // With the lane still picked, a search that opens an item makes All the selected filter too; the compact action+ // says New and retains its accessible name.await search('greeting');await key('Enter', 'Enter', 13, '\r');await chrome.waitFor("view.tab === 'items' && !!view.item && view.state === 'all' && view.lane === 'web' && document.querySelector('#find-results').hidden");const both = await read();- assert.deepEqual(both.bar.map((part) => [part.name, part.on]), [['active', false], ['verified', false], ['all', true], ['lane-pick', false], ['new-item', false]], `375px ${scheme}: All and the picked lane both show: ${JSON.stringify(both.bar)}`);+ assert.deepEqual([both.filterLabel, both.bar.map((part) => part.name)], ['Filter: All · web', ['list', 'pipeline', 'filter-toggle', 'new-item']], `375px ${scheme}: All and the picked lane both show: ${JSON.stringify([both.filterLabel, both.bar])}`);assert.ok(both.bar.every((part) => Math.abs(part.middle - both.bar[0].middle) <= 2) && both.page.scroll <= both.page.width && both.page.body <= both.page.width, `375px ${scheme}: both filters on one row, no sideways scroll: ${JSON.stringify(both)}`);- assert.deepEqual(JSON.parse(await chrome.stable("JSON.stringify((() => { const go = document.querySelector('#new-item'); return [go.textContent, getComputedStyle(go, '::before').content, Math.round(go.getBoundingClientRect().width)]; })())")), ['New item', '"+"', 44], `375px ${scheme}: New item is a 44px + that keeps its name`);+ assert.deepEqual(JSON.parse(await chrome.stable("JSON.stringify((() => { const go = document.querySelector('#new-item'); return [go.innerText, go.getAttribute('aria-label')]; })())")), ['New', 'New item'], `375px ${scheme}: New reads New below 900px and keeps its accessible name (#429)`);// A long lane name gives way rather than the row: with the coordinator lane picked, still one row.await lane('coordinator');await chrome.waitFor("view.lane === 'coordinator'");const long = await read();- assert.deepEqual(long.bar.map((part) => part.name), ['active', 'verified', 'all', 'lane-pick', 'new-item'], `375px ${scheme}: a long lane keeps every control: ${JSON.stringify(long.bar)}`);+ assert.deepEqual(long.bar.map((part) => part.name), ['list', 'pipeline', 'filter-toggle', 'new-item'], `375px ${scheme}: a long lane keeps every control: ${JSON.stringify(long.bar)}`);assert.ok(long.bar.every((part) => Math.abs(part.middle - long.bar[0].middle) <= 2) && long.page.scroll <= long.page.width && long.page.body <= long.page.width, `375px ${scheme}: a long lane name gives way, not the row: ${JSON.stringify(long)}`);- await chrome.click("document.querySelector('[data-state=active]')");+ await chooseFilter('state', 'active');await lane('');await chrome.waitFor('view.lane === null');- assert.deepEqual((await read()).bar.map((part) => part.name), ['active', 'verified', 'new-item'], `375px ${scheme}: every lane shown, the picker drops again`);- assert.equal(await chrome.stable("getComputedStyle(document.querySelector('#new-item'), '::before').content"), 'none', `375px ${scheme}: with only Active and Verified, New item has its words`);+ assert.deepEqual((await read()).bar.map((part) => part.name), ['list', 'pipeline', 'filter-toggle', 'new-item'], `375px ${scheme}: every lane shown, all controls remain`);+ assert.deepEqual(JSON.parse(await chrome.stable("JSON.stringify([document.querySelector('#new-item').innerText, document.querySelector('#new-item').getAttribute('aria-label')])")), ['New', 'New item'], `375px ${scheme}: New stays compact and named when filters clear`);}await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: 'light' }] });