oficina / fichas Public

File menu test: each row on screen with File open, at 1440 and 390

Fable's review (Low 4): comparing the rows at 390 with those at 1440
could not fail, since the server draws the same HTML at every width.
The test now opens File at each width and checks every row is shown and
inside the viewport, which is what proves a phone reaches them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev cbe786e75cdfe6be038497a3adfc3b27c6737a14 parent 4c21e25
2 files changed, +18 −2
  • docs/superpowers/specs/2026-11-17-fichas-level-up.md +1 −1
  • internal/fichastest/browser_file_menu_test.go +17 −1

CI passed — run details

CI log
=== vet ===
go vet ./...
go vet -tags browser ./internal/fichastest/
=== fmt ===
=== test ===
go test ./...
?   	amadan.net/oficina/fichas/cmd/fichas	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas	2.416s
?   	amadan.net/oficina/fichas/internal/fichas/icons	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas/locale	0.008s
ok  	amadan.net/oficina/fichas/internal/fichas/seal	(cached)
ok  	amadan.net/oficina/fichas/internal/fichastest	1.889s
?   	amadan.net/oficina/fichas/scripts/mockups	[no test files]
?   	amadan.net/oficina/fichas/scripts/preview	[no test files]
?   	amadan.net/oficina/fichas/scripts/writeestilo	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
diff --git a/docs/superpowers/specs/2026-11-17-fichas-level-up.md b/docs/superpowers/specs/2026-11-17-fichas-level-up.md
index 78fa05c..5fad8d4 100644
--- a/docs/superpowers/specs/2026-11-17-fichas-level-up.md
+++ b/docs/superpowers/specs/2026-11-17-fichas-level-up.md
@@ -1105,7 +1105,7 @@ Choices made while building, where this spec was silent or the build chose diffe
### After Phase 1
23. **The header has no Search** (Paul, 2026-11-18: "I think we can just lose the search icon in the header"; amends §3.1 and §3.2). The bar's Search, made a lens with "Search ⌘K" as its tooltip that morning (main `6a57585`), is gone, and the rail never had one, so Search moved there, where Mapa has it: the rail's first row, "Search" with ⌘K beside it while the rail is open, the icon with "Search" as its tooltip when folded; and below 800px the Menu sheet's first row (the bar's `Nav`, which the sheet draws), the only Search a phone has on a card or History, which have no Find box. Each goes to the type's Find box (`/t/<type>#find`), focusing it in place on the list. ⌘K, from a page with no Find box, goes where the rail's row goes, never from inside a field; the row (`data-fichas-search`) is in the page below 800px too, where the rail is not drawn. estilo's `Action.IconOnly` stays for a later action. `browser_search_entries_test.go` holds it: no Search in the bar at 1440, 1000, 800 and 390, scripts on and off, nor "Search ⌘K" anywhere; the rail's row open and folded (by width and by choice), from the list and a card, scripts on and off; the sheet's one first row on the list, a card and History; ⌘K and Ctrl+K at three widths, and nothing from inside a field; axe at four widths; no shift in the bar.
-24. **File is the first menu** (Paul, 2026-11-22: "Why is there no 'File' menu? I would have thought File -> Import was a thing"; amends §2 and §3.1). The Card menu is now File (`id="fichas-menu-file"`), as in Docs, Slides and Mapa (Mapa level-up build note 87), and keeps its rows: New <singular> ("New card" off a type), and on a card Open full page, History and Delete…, last and set apart. **Import has a place but no row.** Fichas has no importer yet; the Notion databases phase (§11, the importer's §17) adds "Import from Notion…" after New, as Mapa has it, for its importers only. Until then File draws no Import, rather than a row that leads nowhere. With scripts off File is a `<details>` of links, and below 800px the menus are the bar's own second row (estilo's Menu sheet carries the types and actions, never the menus), so a phone reaches the same rows. No shortcut changed. Copy: "File" went through Luna (`copy-review/file-menu`). Gates: `frame_test.go` holds the menus' order and File's rows off a type, on a type and on a card; `browser_file_menu_test.go` checks File is the first menu and shown, with the same rows, at 1440 and 390, scripts on and off, on the list and a card, with no import link anywhere; File → New customer by pointer at both widths; and axe with File open at 1440 and 390.
+24. **File is the first menu** (Paul, 2026-11-22: "Why is there no 'File' menu? I would have thought File -> Import was a thing"; amends §2 and §3.1). The Card menu is now File (`id="fichas-menu-file"`), as in Docs, Slides and Mapa (Mapa level-up build note 87), and keeps its rows: New <singular> ("New card" off a type), and on a card Open full page, History and Delete…, last and set apart. **Import has a place but no row.** Fichas has no importer yet; the Notion databases phase (§11, the importer's §17) adds "Import from Notion…" after New, as Mapa has it, for its importers only. Until then File draws no Import, rather than a row that leads nowhere. With scripts off File is a `<details>` of links, and below 800px the menus are the bar's own second row (estilo's Menu sheet carries the types and actions, never the menus), so a phone reaches the same rows. No shortcut changed. Copy: "File" went through Luna (`copy-review/file-menu`). Gates: `frame_test.go` holds the menus' order and File's rows off a type, on a type and on a card; `browser_file_menu_test.go` checks File is the first menu and shown, with the same rows, each on screen with File open, at 1440 and 390, scripts on and off, on the list and a card, with no import link anywhere; File → New customer by pointer at both widths; and axe with File open at 1440 and 390.
---
diff --git a/internal/fichastest/browser_file_menu_test.go b/internal/fichastest/browser_file_menu_test.go
index 5552e89..69faea1 100644
--- a/internal/fichastest/browser_file_menu_test.go
+++ b/internal/fichastest/browser_file_menu_test.go
@@ -33,6 +33,15 @@ const fileMenu = `(function () {
imports: document.querySelectorAll('a[href*="import"]').length});
})()`
+// rowsOffScreen names File's rows that are hidden or cross the
+// viewport's sides.
+const rowsOffScreen = `Array.prototype.filter.call(
+ document.querySelectorAll("#fichas-menu-file [estilo-menu-item]"),
+ function (row) {
+ var box = row.getBoundingClientRect();
+ return !row.checkVisibility() || box.left < 0 || box.right > document.documentElement.clientWidth;
+ }).map(function (row) { return row.textContent; }).join(", ")`
+
type fileState struct {
First string
Shown bool
@@ -62,10 +71,17 @@ func TestFileIsTheFirstMenu(t *testing.T) {
if got.First != "File" || !got.Shown {
t.Errorf("%s: the first menu is %q, shown %v", name, got.First, got.Shown)
}
- // The same rows at 390 as at 1440: the phone reaches them.
if !slices.Equal(got.Rows, rows) {
t.Errorf("%s: File is %q, want %q", name, got.Rows, rows)
}
+ // The phone reaches File's very rows: open, each is shown
+ // and inside the viewport's width.
+ var off string
+ s.rig.Run(chromedp.Click(`#fichas-menu-file > summary`),
+ harness.Into(&off, chromedp.Evaluate[string](rowsOffScreen)))
+ if off != "" {
+ t.Errorf("%s: File's rows not on screen: %s", name, off)
+ }
if got.Imports != 0 {
t.Errorf("%s: %d import links, before Fichas has an importer", name, got.Imports)
}