1
0
mirror of https://github.com/gdamore/tcell.git synced 2025-04-24 13:48:51 +08:00
tcell/views/textarea_test.go
VÖRÖSKŐI András e277d9c03b Fix TextArea SetContent method
SetContent should overwrite the model, not append to it.

Add a test to check model's width and height after SetContent calls.
2020-05-07 07:39:48 -07:00

18 lines
448 B
Go

package views
import "testing"
func TestSetContent(t *testing.T) {
ta := &TextArea{}
ta.SetContent("This is a quite long line.") // This line is longer than 11.
ta.SetContent("Four.\nFive...\n...and Six.") //"...and Six." should be 11 long.
if ta.model.height != 3 {
t.Errorf("Incorrect height: %d, expected: %d", ta.model.height, 3)
}
if ta.model.width != 11 {
t.Errorf("Incorrect width: %d, expected: %d", ta.model.width, 11)
}
}