| 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 |