package web
import (
"strings"
"testing"
)
// An empty list under a filter says the filter matched nothing and
// offers to clear it, rather than reading as an empty tracker.
func TestAnEmptyFilteredTicketListNamesItsFilter(t *testing.T) {
var buf strings.Builder
d := pageData{Title: "Tickets", Repo: "quarry",
Nav: ticketNav{Repo: "quarry", State: "open", Title: "7777"}}
if err := noHooks.template(ticketListPage).ExecuteTemplate(&buf, "tkt-view", d); err != nil {
t.Fatal(err)
}
body := buf.String()
if !strings.Contains(body, `data-hook="ticket-none-filtered"`) || !strings.Contains(body, "7777") {
t.Errorf("FAIL: the empty filtered list does not name its filter: %s", body)
}
t.Log("ok")
}