1package ui23import (4 "strings"5 "testing"67 tea "charm.land/bubbletea/v2"8)910// Every menu of the menu bar shows whole, its last item and its bottom11// border, on a terminal 30 rows tall, above the status line.12func TestMenusFitThirtyRows(t *testing.T) {13 m := newModel()14 m.Update(tea.WindowSizeMsg{Width: 100, Height: 30})15 for i, menu := range menuBar {16 m.showBarMenu(i)17 b := m.overlay.Layout()[0]18 if bottom := b.Y + len(b.Lines); bottom > m.height-1 {19 t.Errorf("%s reaches row %d of %d", menu.title, bottom, m.height)20 }21 last := menu.items[len(menu.items)-1].label()22 if !strings.Contains(screen(m), last) {23 t.Errorf("%s: %q isn't shown", menu.title, last)24 }25 m.closeOverlay()26 }27}