Skip to content

Commit

Permalink
chore: add bg/fg/cur terminal color command test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Aug 15, 2024
1 parent cdc2503 commit e6ad78c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions screen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tea

import (
"bytes"
"image/color"
"testing"
)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e6ad78c

Please sign in to comment.