cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

cat/module-path
012 / e2e / screennotes_test.go
screennotes_test.go 2.8K
1package e2e23import ghostty "go.mitchellh.com/libghostty"45// Golden screens for notes and protected ranges: a note on the active6// cell and in the box shown on hover, the note being typed, the warning7// before an edit to a protected range, and the list of protections.89// notedBudget is the budget with a two-line note on Rent's amount.10func notedBudget(s *session) {11 budget(s)12 s.keys("<up>", "<up>", "<up>", "<up>", "<shift+f2>")13 s.waitFor("Note on B3:")14 s.keys("Due on the 1st", "<alt+enter>", "Paid by autopay from checking", "<enter>")15 s.waitFor("Note Due on the 1st")16}1718// protectedBudget is the budget with its amounts protected.19func protectedBudget(s *session) {20 budget(s)21 s.keys("<up>", "<up>", "<up>", "<up>", "<shift+down>", "<shift+down>", "<ctrl+k>", "protect range", "<enter>")22 s.waitFor("Describe B3:B5 (optional):")23 s.keys("Monthly amounts", "<enter>")24 s.waitFor("B3:B5 is protected")25}2627var noteScreens = []screen{28 {name: "note", setup: notedBudget},29 {name: "note-typing", setup: func(s *session) {30 notedBudget(s)31 s.keys("<shift+f2>")32 s.waitFor("Note on B3:")33 }},34 {name: "note-hover", setup: func(s *session) {35 notedBudget(s)36 s.keys("<down>", "<down>")37 s.mouse(ghostty.MouseActionMotion, ghostty.MouseButtonUnknown, 6+10+4, gridRow1+2, 0)38 s.waitFor("┌─ Note ─")39 }},40 {name: "note-hover-narrow", opts: options{cols: 60, rows: 16}, setup: func(s *session) {41 notedBudget(s)42 s.keys("<left>")43 s.mouse(ghostty.MouseActionMotion, ghostty.MouseButtonUnknown, 6+10+4, gridRow1+2, 0)44 s.waitFor("┌─ Note ─")45 }},46 {name: "note-hover-bottom", opts: options{cols: 60, rows: 16}, setup: func(s *session) {47 // A note on the last row shown: the box moves up, clear of the48 // status line.49 s.keys("<f5>", "B11", "<enter>", "<shift+f2>")50 s.waitFor("Note on B11:")51 s.keys("Checked against", "<alt+enter>", "the bank statement", "<alt+enter>", "on the 3rd", "<enter>")52 s.waitFor("Note Checked against")53 s.keys("<ctrl+home>")54 s.mouse(ghostty.MouseActionMotion, ghostty.MouseButtonUnknown, 6+10+4, gridRow1+10, 0)55 s.waitFor("┌─ Note ─")56 }},57 {name: "protect-warning", setup: func(s *session) {58 protectedBudget(s)59 s.keys("<esc>", "<down>", "100")60 s.waitFor("Edit anyway")61 }},62 {name: "protect-warning-narrow", opts: options{cols: 60, rows: 16}, setup: func(s *session) {63 protectedBudget(s)64 s.keys("<esc>", "<down>", "100")65 s.waitFor("Edit anyway")66 }},67 {name: "protect-picker", setup: func(s *session) {68 protectedBudget(s)69 s.keys("<esc>", "<ctrl+k>", "protect sheets", "<enter>")70 s.waitFor("+ Protect the sheet")71 }},72}7374func init() {75 light := map[string]bool{"note": true, "note-hover": true, "note-hover-bottom": true, "protect-warning": true}76 for _, sc := range noteScreens {77 screens = append(screens, sc)78 if light[sc.name] {79 sc.name += "-light"80 sc.opts.light = true81 screens = append(screens, sc)82 }83 }84}