Overlays: review r1 fixes

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 12:59:33 -04:00
1 parent a27727bc71
commit e631f88cc0
41 files changed
+770 -278

No files matched your search

+22
View File
@@ -1,6 +1,7 @@
package mujica
import (
"strings"
"testing"
"github.com/egoist/mygo/ui"
@@ -76,6 +77,27 @@ func TestPopoverOutsideClickAndEscape(t *testing.T) {
}
}
func TestPopoverFitsWindow(t *testing.T) {
open := true
var panel ui.Rect
tt := ui.NewTester(func(c *ui.Context) {
Use(c, Settings{})
ui.Column(c).Padding(30).Children(func() {
b := Button(c, "Filter", ButtonOptions{})
if p := Popover(c, b, &open, PopoverOptions{Width: 1000}, func() {
ui.Text(c, strings.Repeat("Long row of guests. ", 200))
Button(c, "Bottom", ButtonOptions{})
}); p != nil {
panel = p.Bounds()
}
})
}, 400, 300)
tt.Frame()
if panel.W > 400 || panel.X < 0 || panel.Y+panel.H > 300 {
t.Fatalf("panel %+v outside the 400×300 window", panel)
}
}
func TestPopoverNeedsAnchor(t *testing.T) {
defer func() {
if recover() == nil {