cat / 012
clone

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

main
012 / e2e / formula_help_test.go
formula_help_test.go 1.5K
1package e2e23import (4 "testing"5)67// Typing =su shows matching functions under the formula bar; Tab inserts8// one, and the context line then shows its signature.9func TestAutocompleteAndSignature(t *testing.T) {10 t.Parallel()11 s := start(t, "")12 s.keys("2", "<enter>", "3", "<enter>", "=sum")13 s.waitFor("│ SUM ")14 s.waitFor("Sum of numbers")15 s.keys("<tab>")16 s.waitForEntry("=SUM(")17 s.waitFor("SUM(value1, [value2, ...])")18 s.keys("A1", ",", "A2", ")", "<enter>")19 s.waitForLine(gridRow1+2, numRow(3, "5"))20}2122// A named range is defined from the selection, used in a formula, found23// by Go to, and follows inserted rows.24func TestNamedRanges(t *testing.T) {25 t.Parallel()26 s := start(t, "")27 s.keys("10", "<enter>", "20", "<enter>", "=SUM(Pair)", "<enter>")28 s.waitFor("#NAME?")29 s.keys("<ctrl+home>", "<shift+down>", "<alt+d>", "d", "<enter>")30 s.waitFor("Name for A1:A2:")31 s.keys("Pair", "<enter>")32 s.waitForName("Pair")33 s.waitForLine(gridRow1+2, numRow(3, "30"))3435 s.keys("<ctrl+home>", "<ctrl+alt+=>")36 s.waitForLine(gridRow1+3, numRow(4, "30"))37 s.keys("<f5>", "pair", "<enter>")38 s.waitForName("Pair")39 s.keys("<alt+d>", "n")40 s.waitFor("A2:A3")41 s.waitFor("│ Pair A2:A3")42}4344// Alt+, jumps to what a formula reads; Esc comes back.45func TestTracePrecedents(t *testing.T) {46 t.Parallel()47 s := start(t, "")48 s.keys("1", "<enter>", "2", "<enter>", "=A1+A2", "<enter>", "<up>")49 s.keys("<alt+,>")50 s.waitFor("2 precedents of A3: A1, A2")51 s.waitForName("A1")52 s.keys("<alt+,>")53 s.waitForName("A2")54 s.keys("<esc>")55 s.waitForBar("A3", "=A1+A2")56}