Documentation
¶
Overview ¶
Package floortest checks that a Bubble Tea program keeps the keys every board shares: tab cycles the views, / filters the list, ? lists the keys, enter opens and esc backs out, and q quits. A program's test calls Check on its own model, as a file system's test calls testing/fstest.TestFS, so a key of the program's own that shadows one of these fails there.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check presses the floor's keys on board, reading its screen after each, and fails t at the first that does not do its part:
- ? shows an overlay naming q among the keys, and esc closes it.
- enter changes the screen. esc then puts back the screen before enter, or leaves it as enter left it.
- / opens a prompt where Has.List is set: what is typed shows and hides rows, and esc clears it, once or twice.
- q quits.
- tab shows another view where Has.Views is set.
No key but q may quit. tab goes last, so every other key acts on the board's opening view. It presses no other key. Check runs a key's commands as the event loop runs them, and hands each message back to the board before it reads the screen, so a reader that opens once its read answers passes. A command still running after wait is abandoned, as a clock's tea.Tick is. So a floor key whose command writes writes in the test. board is ready to draw: sized by a tea.WindowSizeMsg, with what its Init reads delivered. enter acts on the cursor's starting line, so the board starts the cursor where enter opens or folds.
Types ¶
type Has ¶
type Has struct {
// Views is a board of two or more views, which tab cycles.
Views bool
// List is a board whose first view shows rows, which / filters.
List bool
}
Has says what the board holds for tab and / to act on. A tea.Model cannot say whether it has views or a list. Without Has, a tab that does nothing would pass as a board with one view.