oficina / docs Public

Re-pin estilo bar-stack (3953755); move every undo test to the bar's pair

richer.mjs and browser-drive.mjs read and click the bar's lead pair, and
richer.mjs holds the strip's pair to it; browser-drive's tab count is
barStops + 2 now the menu bar is in the bar. The font wait's inert
checks cover both pairs and Format. TestToolbarOptionValuesMatchTheBundle
reads views/partials/editor_bar.html too. The rename test no longer pins
estilo's title size guess.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 36f0b22c225116d3e68bf1ce2a6ce0172116e5d2 parent 8d8d365
8 files changed, +49 −15
  • fixtures/browser-drive.mjs +11 −4
  • fixtures/engines/i2.mjs +1 −1
  • fixtures/engines/richer.mjs +10 −4
  • go.mod +1 −1
  • go.sum +2 −0
  • internal/docs/chrome_test.go +5 −1
  • internal/docs/export_test.go +11 −0
  • internal/docs/fonts_browser_test.go +8 −4

CI passed — run details

diff --git a/fixtures/browser-drive.mjs b/fixtures/browser-drive.mjs
index 8b6792a..07e287e 100644
--- a/fixtures/browser-drive.mjs
+++ b/fixtures/browser-drive.mjs
@@ -446,9 +446,10 @@ async function editorChecks() {
// Undo has to be available now, and has to walk the heading back.
check('undo becomes available after an edit', !(await evaluate(
- `document.querySelector('[docs-toolbar] [data-docs-command="undo"]').disabled`,
+ `document.querySelector('[estilo-bar-lead] [data-docs-command="undo"]').disabled`,
)))
- await clickSelector('[docs-toolbar] [data-docs-command="undo"]')
+ // The bar's lead pair: from 800px it is the one drawn (spec I2).
+ await clickSelector('[estilo-bar-lead] [data-docs-command="undo"]')
try {
await settleOn(`the heading to be undone`, () => blockTag(paragraphIndex), (tag) => tag === 'P')
check('undo reverses the last change', true)
@@ -1131,10 +1132,16 @@ async function caretChecks() {
// formatting bar as one stop, then the editor. So the editor is
// exactly barStops + 3 presses away, and a menu bar or toolbar that
// leaks a second stop makes it barStops + 4 or more.
+ // I2 (spec 2026-11-11): the menu bar is inside the estilo bar now,
+ // so barStops counts it, as one stop, with the undo/redo pair and
+ // Format; after the bar comes only the formatting bar, as one stop
+ // (the inspector at this drive's 1280px), then the editor. So the
+ // editor is exactly barStops + 2 presses away, and a menu bar or
+ // toolbar that leaks a second stop makes it more.
check(
'the menu bar and the formatting bar are one tab stop each',
- reachedAfter > 0 && reachedAfter === barStops + 3,
- `the editor was ${reachedAfter} tab presses from the brand; the bar has ${barStops} stops of its own, so ${barStops + 3} was expected`,
+ reachedAfter > 0 && reachedAfter === barStops + 2,
+ `the editor was ${reachedAfter} tab presses from the brand; the bar has ${barStops} stops of its own, so ${barStops + 2} was expected`,
)
// 9. ...and the arrow keys are what move inside it.
diff --git a/fixtures/engines/i2.mjs b/fixtures/engines/i2.mjs
index 8ff0aa9..f984cc8 100644
--- a/fixtures/engines/i2.mjs
+++ b/fixtures/engines/i2.mjs
@@ -132,7 +132,7 @@ for (const engine of [chromium, webkit]) {
if (!(await until(async () => (await pair('[estilo-bar-lead]')) === 'false,true'))) fail(`1280: after a keyboard redo the header's undo/redo are ${await pair('[estilo-bar-lead]')}, want enabled, disabled`)
if ((await pair('[docs-bar]')) !== (await pair('[estilo-bar-lead]'))) fail(`1280: the strip's pair (${await pair('[docs-bar]')}) disagrees with the header's (${await pair('[estilo-bar-lead]')})`)
// And the header's undo button does undo.
- await page.click('[estilo-bar-lead] [data-docs-command="undo"]')
+ await page.click('[estilo-bar-lead] [data-docs-command="undo"]', { timeout: 3000 }).catch(() => fail('1280: the header\'s Undo could not be clicked'))
if (!(await until(async () => !(await page.locator('[docs-text]').innerText()).includes('xyz')))) fail('1280: the header\'s Undo did not undo')
// 2. Format: closed in place, then the tab path and Escape.
diff --git a/fixtures/engines/richer.mjs b/fixtures/engines/richer.mjs
index 34e0634..546f1ab 100644
--- a/fixtures/engines/richer.mjs
+++ b/fixtures/engines/richer.mjs
@@ -5,9 +5,9 @@
// DOCS_ENGINES_CONFIG as first-reveal.mjs: one "simple" and one "empty"
// document per engine.
//
-// 1. Undo and Redo on the toolbar follow keyboard undo and redo. Those
-// never touch the toolbar, and the buttons used to keep whatever the
-// last toolbar-driven change had left.
+// 1. Undo and Redo (the bar's lead pair, and the strip's with it) follow
+// keyboard undo and redo. Those never touch the buttons, which used
+// to keep whatever the last button-driven change had left.
// 2. An empty document opens with the caret in it; a document with text
// does not take focus.
// 3. On the list, a search emptied with Backspace stays on its results;
@@ -27,7 +27,13 @@ for (const engine of [chromium, webkit]) {
await context.addCookies(config.cookies.map((c) => ({ name: c.Name, value: c.Value, url: config.origin, httpOnly: c.HttpOnly, sameSite: 'Lax' })))
const page = await context.newPage()
const focusInText = () => page.evaluate(() => !!document.activeElement && !!document.activeElement.closest('[docs-text]'))
- const disabled = (cmd) => page.evaluate((c) => document.querySelector(`[docs-tool][data-docs-command="${c}"]`).disabled, cmd)
+ // The pair a person sees at this width is the bar's lead slot's (spec
+ // I2); the strip's, drawn below 800px, must agree with it.
+ const disabled = (cmd) => page.evaluate((c) => {
+ const lead = document.querySelector(`[estilo-bar-lead] [data-docs-command="${c}"]`).disabled
+ const strip = document.querySelector(`[docs-bar] > [docs-history] [data-docs-command="${c}"]`).disabled
+ return lead === strip ? lead : 'the two pairs disagree'
+ }, cmd)
const until = async (fn, ms = 3000) => {
const end = Date.now() + ms
while (Date.now() < end) {
diff --git a/go.mod b/go.mod
index a2973f5..ce40cfa 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.26.5
require (
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000
- amadan.net/oficina/estilo.git v0.0.0-20261111231134-ecb81fcf2a4a
+ amadan.net/oficina/estilo.git v0.0.0-20261111233740-395375547dca
amadan.net/oficina/home/connect v0.0.0-20261101223546-d82341cd9a0c
amadan.net/oficina/home/dashboard v0.0.0-20261024235511-baa2503c7064
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489
diff --git a/go.sum b/go.sum
index ddbfa7c..e2889b0 100644
--- a/go.sum
+++ b/go.sum
@@ -4,6 +4,8 @@ amadan.net/oficina/estilo.git v0.0.0-20261110225909-62be5bcc8ad7 h1:BxvPwmUzKfre
amadan.net/oficina/estilo.git v0.0.0-20261110225909-62be5bcc8ad7/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
amadan.net/oficina/estilo.git v0.0.0-20261111231134-ecb81fcf2a4a h1:bsUcN0adAIJiDtPT+lM2Pr1NPS1gDMD+VrIHA40Qry4=
amadan.net/oficina/estilo.git v0.0.0-20261111231134-ecb81fcf2a4a/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
+amadan.net/oficina/estilo.git v0.0.0-20261111233740-395375547dca h1:8mKomq5GsxlrLDOQEdzl3nVUh79wwmXG9sCqbge6gEk=
+amadan.net/oficina/estilo.git v0.0.0-20261111233740-395375547dca/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
amadan.net/oficina/home/connect v0.0.0-20261101223546-d82341cd9a0c h1:6NOvTeDLlctihXkIa/FCr1np3N3N4oKB0YS9x8VSfxI=
amadan.net/oficina/home/connect v0.0.0-20261101223546-d82341cd9a0c/go.mod h1:ix81eFV87yE9f2SXiRuxYCVM4lAgTRC5YoQMiH3+TDk=
amadan.net/oficina/home/dashboard v0.0.0-20261024235511-baa2503c7064 h1:2YbDksZDxpY9khlhXmTeiM89yze7w2XfYSumtrzH4tc=
diff --git a/internal/docs/chrome_test.go b/internal/docs/chrome_test.go
index 7fafd08..24da549 100644
--- a/internal/docs/chrome_test.go
+++ b/internal/docs/chrome_test.go
@@ -197,7 +197,11 @@ func TestTheBarRenamesTheDocument(t *testing.T) {
alice := signInCookies(t, app, "alice@example.com")
sqid := createDoc(t, app, alice, "Untitled")
body := get(t, app, alice, "/d/"+sqid).Body.String()
- if !strings.Contains(body, `<form estilo-bar-title method="post" action="/d/`+sqid+`/title">`) || !strings.Contains(body, `name="title" value="Untitled" size="8" aria-label="docs.chrome.title.label"`) {
+ // The editor's bar is stacked, so estilo draws the fitted title: its
+ // size attribute is estilo's first guess (TitleEdit.Size), whatever
+ // that guess is.
+ fitted := regexp.MustCompile(`name="title" value="Untitled" size="\d+" aria-label="docs.chrome.title.label"`)
+ if !strings.Contains(body, `<form estilo-bar-title method="post" action="/d/`+sqid+`/title">`) || !fitted.MatchString(body) {
t.Fatal("a writer has no editable title in the bar")
}
req := httptest.NewRequest(http.MethodPost, "/d/"+sqid+"/title", strings.NewReader("title=Board+minutes"))
diff --git a/internal/docs/export_test.go b/internal/docs/export_test.go
index 9c41273..fbe3f18 100644
--- a/internal/docs/export_test.go
+++ b/internal/docs/export_test.go
@@ -604,6 +604,17 @@ func TestToolbarOptionValuesMatchTheBundle(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ // The undo/redo pair (the bar's lead slot's and the strip's) and the
+ // menu bar's markup live in a partial since I2; its literal commands
+ // are held to the bundle too.
+ partial, err := os.ReadFile("views/partials/editor_bar.html")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(string(partial), `data-docs-command="undo"`) || !strings.Contains(string(partial), `data-docs-command="redo"`) {
+ t.Fatal("views/partials/editor_bar.html renders no undo/redo pair")
+ }
+ page = append(append(page, '\n'), partial...)
bundle, err := os.ReadFile("../../fixtures/toolbar.mjs")
if err != nil {
t.Fatal(err)
diff --git a/internal/docs/fonts_browser_test.go b/internal/docs/fonts_browser_test.go
index 8e8d230..040a63a 100644
--- a/internal/docs/fonts_browser_test.go
+++ b/internal/docs/fonts_browser_test.go
@@ -1262,7 +1262,8 @@ const waitLogJS = `(() => {
const rec = () => window.__waitLog.push({
ms: Math.round(performance.now()),
inert: !!text.inert,
- bar: !!document.querySelector('[docs-toolbar]').inert && !!document.querySelector('[estilo-menubar]').inert,
+ bar: [...document.querySelectorAll('[docs-toolbar], [estilo-menubar], [docs-history], [data-estilo-toggle]')].every((el) => el.inert) &&
+ document.querySelectorAll('[docs-toolbar], [estilo-menubar], [docs-history], [data-estilo-toggle]').length === 5,
state: (status && status.getAttribute('data-state')) || '',
shown: !!status && getComputedStyle(status).opacity === '1',
text: text.innerText.replace(/\n+/g, '|'),
@@ -1300,14 +1301,17 @@ func (fr *fontRig) settled(t *testing.T) {
chromedp.WithPollingTimeout(15*time.Second)))
}
-// inWait reports whether the editor and both bars are inert and the
+// inWait reports whether the editor and the chrome that drives it are
+// inert (the toolbar, the menu bar, both undo/redo pairs and the bar's
+// Format toggle: spec I2) and the
// status strip visibly says a font is loading, right now.
func (fr *fontRig) inWait(t *testing.T) bool {
t.Helper()
var on bool
fr.eval(t, `(() => { const s = document.querySelector('[docs-fonts-status]');
- return !!document.querySelector('[docs-text]').inert && !!document.querySelector('[docs-toolbar]').inert &&
- !!document.querySelector('[estilo-menubar]').inert && !!s && ['loading', 'refused'].includes(s.getAttribute('data-state')) &&
+ const chrome = document.querySelectorAll('[docs-toolbar], [estilo-menubar], [docs-history], [data-estilo-toggle]');
+ return !!document.querySelector('[docs-text]').inert && chrome.length === 5 && [...chrome].every((el) => el.inert) &&
+ !!s && ['loading', 'refused'].includes(s.getAttribute('data-state')) &&
getComputedStyle(s).opacity === '1' && s.querySelector('[role="status"]').textContent.trim() !== '' })()`, &on)
return on
}