package httpd import ( "html/template" "net/url" "strings" "testing" "gitbay.org/gitbay/internal/store" "gitbay.org/gitbay/internal/web" ) // renderIssues renders issues.html around the facets given, which is the // shared sidecol partial every list page uses. func renderIssues(t *testing.T, facets []facetGroup) string { t.Helper() var sb strings.Builder err := web.Render(&sb, "issues.html", struct { repoPage State string Label string Query string Filters []listFilter Facets []facetGroup Issues []store.Issue LabelColors map[string]template.CSS Older string }{repoPage: testRepoPage(), State: "open", Facets: facets}) if err != nil { t.Fatalf("render: %v", err) } return sb.String() } // The column's groups sit inside a details.sidedrop whose summary names // the filters in force. Below 62rem that disclosure is the column; above // it style.css hides the summary and shows the content, so the markup is // the same either way (#237). func TestSidecolIsADisclosure(t *testing.T) { base := url.Values{"state": {"open"}, "label": {"bug"}} labels := []store.Label{{Name: "bug", Issues: 2}} facets := listFacets(base, []string{"open", "closed"}, "open", labels, nil, false) out := renderIssues(t, facets) nav := strings.Index(out, `