| index fb58bdb..291bd4b 100644 |
| --- a/internal/docs/phone_sheet_browser_test.go |
| +++ b/internal/docs/phone_sheet_browser_test.go |
| @@ -155,3 +155,30 @@ func TestTheSheetFromAKeyboard(t *testing.T) { |
| t.Errorf("Escape: sheet open %v, focus on %q, want it closed and focus back on Aa", at.Open, at.Active) |
| } |
| } |
| + |
| +// openWithKeyboard puts the caret in the second paragraph, raises a |
| +// 336px keyboard, selects that paragraph and opens the sheet from the |
| +// capsule's Aa. |
| +func (s *sheetRig) openWithKeyboard() { |
| + s.t.Helper() |
| + s.run("the caret, a keyboard", chromedp.Click(chromedp.CSS(`[docs-text] p:last-child`)), settle, |
| + do(`__keyboard(336, 0)`), settle, |
| + do(`getSelection().selectAllChildren(document.querySelector('[docs-text] p:last-child'))`), settle, |
| + chromedp.Click(chromedp.CSS(`[docs-quickbar-aa]`)), settle) |
| + if p := s.probe("sheet open"); !p.Sheet || !p.Kept || p.Focused { |
| + s.t.Fatalf("the sheet did not open over a kept selection: %+v", p) |
| + } |
| +} |
| + |
| +// Review 2: a tap in the document while the sheet is open closes it: |
| +// the keyboard comes up with the capsule on it, nothing kept is drawn |
| +// over the live selection, and Aa is no longer expanded. |
| +func TestATapInTheDocumentClosesTheSheet(t *testing.T) { |
| + s := newSheetRig(t, "simple.bin", "") |
| + s.openWithKeyboard() |
| + s.run("a tap in the document", chromedp.Click(chromedp.CSS(`[docs-text] p:first-child`)), settle) |
| + if p := s.probe("tapped"); p.Sheet || p.Kept || !p.Focused || p.Quick != "keyboard" || p.Expanded != "false" { |
| + t.Errorf("after a tap in the document: sheet %v, kept drawn %v, caret %v, quick bar %q, Aa expanded %q; want closed, none, the caret, the capsule, false", |
| + p.Sheet, p.Kept, p.Focused, p.Quick, p.Expanded) |
| + } |
| +} |