floortest

package
v0.78.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Check(t testing.TB, board tea.Model, has Has)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL