oficina / slides Public

Test: the tidy tests use the box's menu where they pressed the card

- TestTidyCardSurvivesBoxRemoval: the colleague deletes through the
  box's menu.
- TestBrowserUploadsAnImage (browser_assets_test.go): the image is
  deleted through the box's menu (pressBoxMenuRow).
- TestTidyCardFollowsSelection: inspectJS leaves out the closed
  Position and size group and corner radius on a non-rectangle;
  groupsJS names a group by its summary where it has no label.
- TestTidyKeyboardOnlyBox removed: TestQuieterKeyboardOnlyShape
  replaces it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 299c7c1e9598ba83fd6f9eb9fe9eb6bf8d166334 parent 1953b44
2 files changed, +14 −83
  • internal/slidestest/browser_assets_test.go +1 −1
  • internal/slidestest/browser_editor_tidy_test.go +13 −82
diff --git a/internal/slidestest/browser_assets_test.go b/internal/slidestest/browser_assets_test.go
index 9e061fc..cb1a3b5 100644
--- a/internal/slidestest/browser_assets_test.go
+++ b/internal/slidestest/browser_assets_test.go
@@ -153,7 +153,7 @@ func TestBrowserUploadsAnImage(t *testing.T) {
rig.Run(
chromedp.Click(`[slides-stage] [data-block="image"]`, chromedp.ByQuery),
waitFor(`document.querySelector('[slides-inspector-form][data-section="block"]').checkVisibility() === true`),
- chromedp.Click(`[data-command="block-delete"]`, chromedp.ByQuery),
+ pressBoxMenuRow("block-delete"), // the box's menu (Q4)
waitFor(`document.querySelector('[slides-stage] [data-block="image"]') === null`),
waitFor(saved),
waitFor(`document.querySelectorAll('[slides-unused-list] > li').length === 1`),
diff --git a/internal/slidestest/browser_editor_tidy_test.go b/internal/slidestest/browser_editor_tidy_test.go
index 403d8ee..a7338ed 100644
--- a/internal/slidestest/browser_editor_tidy_test.go
+++ b/internal/slidestest/browser_editor_tidy_test.go
@@ -1111,6 +1111,10 @@ const inspectJS = `(() => {
for (let p = el; p && p !== form('block'); p = p.parentElement) {
if (p.hasAttribute('data-types') && !p.getAttribute('data-types').split(' ').includes(kind)) ok = false
if (p.hasAttribute('data-layout') && p.getAttribute('data-layout') !== layout) ok = false
+ // A shape's field for some kinds alone (corner radius), and
+ // Position and size, a group closed until it is opened (Q4).
+ if (p.hasAttribute('data-kinds') && kind === 'shape' && !p.getAttribute('data-kinds').split(' ').includes(sel.dataset.kind || 'rect')) ok = false
+ if (p.matches('details:not([open])') && el.parentElement !== p) ok = false
}
if (ok) want.push(el.name)
}
@@ -1241,7 +1245,8 @@ func TestTidyCardFollowsSelection(t *testing.T) {
const out = {}
for (const g of document.querySelectorAll('[slides-inspector] form[data-section="block"] [data-group]')) {
if (!g.checkVisibility()) continue
- out[g.querySelector('[estilo-inspector-label]').textContent] = [...g.querySelectorAll('[name]')].filter(el => el.checkVisibility()).map(el => el.name)
+ // A group's label, or its disclosure's summary (Position and size, Q4).
+ out[(g.querySelector('[estilo-inspector-label]') || g.querySelector('summary')).textContent.trim()] = [...g.querySelectorAll('[name]')].filter(el => el.checkVisibility()).map(el => el.name)
}
return out
})()`
@@ -1432,9 +1437,11 @@ func TestTidyCardSurvivesBoxRemoval(t *testing.T) {
chromedp.Click(`[slides-stage] [data-block="shape"]`, chromedp.ByQuery),
waitFor(`document.querySelector('[slides-editor]').dataset.inspect === 'box'`),
)
- // The clock starts at the press on Delete block over there.
+ // The clock starts at the press on Delete, in the box's menu (Q4),
+ // over there.
+ runOn(t, tab2, openBoxMenu())
start := time.Now()
- runOn(t, tab2, chromedp.Click(`[slides-inspector] [data-command="block-delete"]`, chromedp.ByQuery))
+ runOn(t, tab2, chromedp.Click(`[slides-box-menu] [data-row="block-delete"]`, chromedp.ByQuery))
te.rig.Run(waitFor(`document.querySelector('[slides-editor]').dataset.inspect === 'slide' && !document.querySelector('[slides-stage] [data-block="shape"]')`))
if took := time.Since(start); took > time.Second {
t.Errorf("the card took %v to leave the deleted box, want under a second", took)
@@ -1730,85 +1737,9 @@ func slicesHas(s []string, v string) bool {
return false
}
-// TestTidyKeyboardOnlyBox (spec §4.4): a shape on a canvas slide, the
-// one kind of box with no text to put a caret in, reached and changed
-// with the keyboard alone, with the card showing and again starting
-// with it hidden: Tab to the shape (its overlay, the shape selected and
-// its options in the card), its fill, Esc back to the shape still
-// selected, Delete block. The notes are closed first: Tab from a box
-// passes through the notes before the card, and the caret there turns
-// the card to the notes' marks.
-func TestTidyKeyboardOnlyBox(t *testing.T) {
- te := openTidyEditor(t, 2, 1280, 720)
- canvas := te.addCanvasShape(t)
- te.rig.Run(
- chromedp.Click(`[slides-notes-close]`, chromedp.ByQuery),
- waitFor(`document.querySelector('[slides-notes-pane]').dataset.state === 'closed'`),
- )
- for _, hidden := range []bool{false, true} {
- name := "the card showing"
- if hidden {
- name = "the card hidden at first"
- }
- te.openOn(canvas)
- onShape := func(after string) {
- t.Helper()
- var s tabStep
- te.rig.Run(chromedp.Evaluate(tabStepJS, &s))
- if !s.In || !s.Overlay || s.Kind != "shape" || !s.Selected || s.Inspect != "box" {
- t.Errorf("%s, %s: %+v; want focus on the shape's overlay, the shape selected and its options in the card", name, after, s)
- }
- }
- if hidden {
- te.pressFormat("closed")
- }
- // From the top of the page, Tab to the shape.
- te.rig.Run(chromedp.Evaluate(`document.activeElement.blur()`, nil))
- te.tabTo(t, `[slides-stage] [slides-canvas-overlay]`, 80)
- onShape("reached by Tab")
- if hidden {
- te.rig.Run(
- chromedp.Evaluate(`document.querySelector('[slides-menu="view"] > summary').focus()`, nil),
- chromedp.KeyEvent(kb.Enter),
- waitFor(`document.querySelector('[slides-menu="view"]').open`),
- )
- te.tabTo(t, `[estilo-menu-item][data-view-toggle="inspector"]`, 12)
- te.rig.Run(chromedp.KeyEvent(kb.Enter), waitFor(`document.querySelector('[slides-inspector]').dataset.state === 'open'`))
- var in bool
- te.rig.Run(chromedp.Evaluate(`(a => !!a.closest('form[data-section="block"]') && a.checkVisibility())(document.activeElement)`, &in))
- if !in {
- t.Fatalf("%s: View → Inspector by keyboard leaves focus %+v; want it on the first control of the shape's options", name, te.focus())
- }
- }
-
- // Its fill: Tab to the field; the colour picker itself is the
- // browser's, so its choice is written as the picker would.
- te.tabTo(t, `#rst-block-fill`, 40)
- te.rig.Run(
- chromedp.Evaluate(`(f => { f.value = '#cc3300'; f.dispatchEvent(new Event('input', {bubbles: true})); f.dispatchEvent(new Event('change', {bubbles: true})) })(document.activeElement)`, nil),
- waitFor(`document.querySelector('[slides-stage] [data-block="shape"]').outerHTML.toLowerCase().includes('cc3300')`),
- )
-
- // Esc in the card: focus back on the shape, still selected, its
- // options still showing (Q5).
- te.rig.Run(chromedp.KeyEvent(kb.Escape))
- onShape("Esc in its options")
-
- te.tabTo(t, `[slides-inspector] [data-command="block-delete"]`, 60)
- te.rig.Run(
- chromedp.KeyEvent(kb.Enter),
- waitFor(`!document.querySelector('[slides-stage] [data-block="shape"]')`),
- waitFor(`document.querySelector('[slides-editor]').dataset.inspect === 'slide'`),
- )
- // Put the shape back for the next pass.
- if !hidden {
- sqid := strings.TrimSuffix(strings.TrimPrefix(te.path, "/d/"), "/edit")
- token := mintAgent(t, te.app, te.cookies, "shape-again")
- apiJSON(t, te.app, http.MethodPost, "/api/v1/decks/"+sqid+"/ops", token,
- `{"ops":[{"op":"add_block","slide":`+quote(canvas)+`,"type":"shape","props":{},"box":{"x":0.1,"y":0.1,"w":0.4,"h":0.3},"z":0,"markdown":"Shape"}]}`, http.StatusOK)
- }
- }
-}
+// TestTidyKeyboardOnlyBox is TestQuieterKeyboardOnlyShape now
+// (browser_quieter_box_test.go): the shape is changed and deleted from
+// its menu and its keys, Delete block having left the card (Q4).
// TestTidyDeleteSlideConfirmsInCard (spec E10, §4.3, §4.4): with the
// card hidden, Delete slide from the Slide menu and from a slide's own