Overlays: review r1 fixes
This commit is contained in:
41 files changed
+770
-278
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package mujica
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo/ui"
|
||||
@@ -59,6 +60,25 @@ func TestPopconfirmCancelPaths(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPopconfirmKeepsActionsInWindow(t *testing.T) {
|
||||
long := strings.Repeat("The east gate stays unwatched tonight. ", 60)
|
||||
open := true
|
||||
tt := ui.NewTester(func(c *ui.Context) {
|
||||
Use(c, Settings{})
|
||||
ui.Column(c).Padding(30).Children(func() {
|
||||
b := Button(c, "Archive", ButtonOptions{})
|
||||
Popconfirm(c, b, &open, PopconfirmOptions{Title: "Archive?", Description: long})
|
||||
})
|
||||
}, 400, 300)
|
||||
tt.Frame()
|
||||
for _, label := range []string{"Confirm", "Cancel"} {
|
||||
r, ok := tt.Find(label)
|
||||
if !ok || r.Y < 0 || r.Y+r.H > 300 || r.X+r.W > 400 {
|
||||
t.Fatalf("%s at %+v outside the 400×300 window", label, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPopconfirmSnapshot(t *testing.T) {
|
||||
snapshot(t, "popconfirm", 420, 220, func(c *ui.Context) {
|
||||
open := true
|
||||
|
||||
Reference in new issue
Block a user