| index ee9c428..dc9fbc7 100644 |
| --- a/internal/slidestest/browser_editor_tidy_test.go |
| +++ b/internal/slidestest/browser_editor_tidy_test.go |
| @@ -1289,6 +1289,39 @@ func TestTidyCardFollowsSelection(t *testing.T) { |
| } |
| } |
| |
| + // Corner radius is Style's, for an image and a shape alike (ruling |
| + // R16): a shape shows no Image group; an image's Image group holds |
| + // its file and fit. |
| + groupsJS := `(() => { |
| + 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) |
| + } |
| + return out |
| + })()` |
| + for _, c := range []struct { |
| + kind string |
| + image []string // nil: no Image group drawn |
| + }{ |
| + {"shape", nil}, |
| + {"image", []string{"rst-block-image", "rst-block-fit", "rst-block-fit"}}, |
| + } { |
| + te.selectBox(c.kind) |
| + var groups map[string][]string |
| + te.rig.Run(chromedp.Evaluate(groupsJS, &groups)) |
| + image, shown := groups["Image"] |
| + if c.image == nil && shown { |
| + t.Errorf("%s selected: an Image group is drawn, holding %v; want none", c.kind, image) |
| + } |
| + if c.image != nil && strings.Join(image, " ") != strings.Join(c.image, " ") { |
| + t.Errorf("%s selected: the Image group holds %v, want %v", c.kind, image, c.image) |
| + } |
| + if !slicesHas(groups["Style"], "rst-block-radius") { |
| + t.Errorf("%s selected: Corner radius is not drawn in Style; the groups are %v", c.kind, groups) |
| + } |
| + } |
| + |
| // Back to the same box from the notes: its options again, though |
| // the selection itself never changed. |
| te.selectBox("shape") |
| @@ -1631,6 +1664,7 @@ func TestTidyMarksInCard(t *testing.T) { |
| chromedp.KeyEvent(kb.Enter), |
| waitFor(`!document.querySelector('[slides-link-dialog]').open`), |
| waitFor(headingEl+`.querySelector('a[href="https://example.test/"]')`), |
| + waitFor(pressed("href")), |
| ) |
| // The shortcuts take each off again. |
| te.rig.Run(chromedp.Focus(`[slides-stage] [data-block="heading"] [contenteditable="true"], [slides-stage] [data-block="heading"][contenteditable="true"]`, chromedp.ByQuery), waitFor(inHeading), modKey("a", input.ModifierCtrl)) |
| @@ -1646,6 +1680,7 @@ func TestTidyMarksInCard(t *testing.T) { |
| waitFor(`document.querySelector('[slides-link-dialog]').open`), |
| chromedp.Click(`[slides-link-dialog] button[value="remove"]`, chromedp.ByQuery), |
| waitFor(`!`+headingEl+`.querySelector('a')`), |
| + waitFor(`!(`+pressed("href")+`)`), |
| ) |
| |
| // The code block: the marks act there as the pill's did. |
| @@ -1695,6 +1730,42 @@ func TestTidyMarksInCard(t *testing.T) { |
| waitFor(`!document.querySelector('[slides-notes]').querySelector('`+tags[m]+`')`), |
| ) |
| } |
| + // The link in the notes: put on with the card's button and taken off |
| + // with Mod+K, then put on with Mod+K and taken off with the button. |
| + const notesLink = `document.querySelector('[slides-notes] a[href="https://example.test/notes"]')` |
| + link := func(open chromedp.Action, how string) { |
| + t.Helper() |
| + te.rig.Run( |
| + open, |
| + waitFor(`document.querySelector('[slides-link-dialog]').open`), |
| + chromedp.SendKeys(`#slides-link-url`, "https://example.test/notes", chromedp.ByQuery), |
| + chromedp.KeyEvent(kb.Enter), |
| + waitFor(`!document.querySelector('[slides-link-dialog]').open`), |
| + waitFor(notesLink), |
| + waitFor(pressed("href")), |
| + ) |
| + var in bool |
| + te.rig.Run(chromedp.Evaluate(`!!`+inNotes, &in)) |
| + if !in { |
| + t.Errorf("a link put on the notes with %s left the caret out of the notes", how) |
| + } |
| + } |
| + unlink := func(open chromedp.Action) { |
| + t.Helper() |
| + te.rig.Run( |
| + open, |
| + waitFor(`document.querySelector('[slides-link-dialog]').open`), |
| + chromedp.Click(`[slides-link-dialog] button[value="remove"]`, chromedp.ByQuery), |
| + waitFor(`!document.querySelector('[slides-notes] a')`), |
| + waitFor(`!(`+pressed("href")+`)`), |
| + ) |
| + } |
| + button := chromedp.Click(`[slides-inspector] [data-mark="href"]`, chromedp.ByQuery) |
| + modK := modKey("k", input.ModifierCtrl) |
| + link(button, "the card's button") |
| + unlink(modK) |
| + link(modK, "Mod+K") |
| + unlink(button) |
| if s := te.marks(); s.Inspect != "notes" { |
| t.Errorf("after the marks in the notes the card is on %q, want notes", s.Inspect) |
| } |