github.com/grahambrereton-form3/tilt@v0.10.18/internal/rty/modal_test.go (about) 1 package rty 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/gdamore/tcell" 8 ) 9 10 func TestModal(t *testing.T) { 11 i := NewInteractiveTester(t, screen) 12 13 { 14 bg := Bg(NewGrowingBox(), tcell.ColorRed) 15 fg := Bg(NewGrowingBox(), tcell.ColorBlue) 16 l := NewModalLayout(bg, fg, 0.8, true) 17 i.Run("modal blue box on red box", 20, 20, l) 18 } 19 20 { 21 bg := NewLines() 22 for i := 0; i < 20; i++ { 23 bg.Add(TextString(strings.Repeat("i", 20))) 24 } 25 26 fg := NewGrowingBox() 27 fg.SetInner(TextString("hello world")) 28 l := NewModalLayout(bg, fg, 0.5, true) 29 i.Run("modal text on top of text", 10, 10, l) 30 } 31 32 { 33 bg := Bg(NewGrowingBox(), tcell.ColorRed) 34 fg := NewFixedSize(Bg(NewGrowingBox(), tcell.ColorBlue), 3, 3) 35 l := NewModalLayout(bg, fg, 0.8, false) 36 i.Run("non-fixed modal blue box on red box", 20, 20, l) 37 } 38 }