From e6ad78c915cf2fa848586d107daeed0d685c7b59 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 15 Aug 2024 14:55:32 -0400 Subject: [PATCH] chore: add bg/fg/cur terminal color command test cases --- screen_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/screen_test.go b/screen_test.go index 728cd9779f..478944abe3 100644 --- a/screen_test.go +++ b/screen_test.go @@ -2,6 +2,7 @@ package tea import ( "bytes" + "image/color" "testing" ) @@ -56,6 +57,16 @@ func TestClearMsg(t *testing.T) { cmds: []Cmd{DisableBracketedPaste, EnableBracketedPaste}, expected: "\x1b[?25l\x1b[?2004h\x1b[?2004l\x1b[?2004h\rsuccess\r\n\x1b[D\x1b[2K\r\x1b[?2004l\x1b[?25h\x1b[?1002l\x1b[?1003l\x1b[?1006l", }, + { + name: "bg_fg_cur_color", + cmds: []Cmd{ForegroundColor, BackgroundColor, CursorColor}, + expected: "\x1b[?25l\x1b[?2004h\x1b]10;?\a\x1b]11;?\a\x1b]12;?\a\rsuccess\r\n\x1b[D\x1b[2K\r\x1b[?2004l\x1b[?25h\x1b[?1002l\x1b[?1003l\x1b[?1006l", + }, + { + name: "bg_set_color", + cmds: []Cmd{SetBackgroundColor(color.RGBA{255, 255, 255, 255})}, + expected: "\x1b[?25l\x1b[?2004h\x1b]11;#ffffff\a\rsuccess\r\n\x1b[D\x1b[2K\r\x1b[?2004l\x1b[?25h\x1b[?1002l\x1b[?1003l\x1b[?1006l", + }, } for _, test := range tests {