27 lines
601 B
Go
27 lines
601 B
Go
package ui
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/rivo/tview"
|
|
)
|
|
|
|
func TestPlainText(t *testing.T) {
|
|
for _, tc := range []struct{ in, want string }{
|
|
{"[green]Done[-]", "Done"},
|
|
{"[red]" + tview.Escape("Movie [1080p] failed"), "Movie [1080p] failed"},
|
|
{"plain", "plain"},
|
|
{"[yellow]a [::b]b[::-]", "a b"},
|
|
} {
|
|
if got := plainText(tc.in); got != tc.want {
|
|
t.Errorf("plainText(%q) = %q, want %q", tc.in, got, tc.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestToastProgress(t *testing.T) {
|
|
if !(toast{text: "Searching…"}).progress() || (toast{text: "Done"}).progress() {
|
|
t.Error("progress detection wrong")
|
|
}
|
|
}
|