Highlight the correct small menu item when viewing a tag

When viewing a tag that isn't associated with a release, highlight the
"N Tags" sub-menu item, rather than the "M releases" one.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2024-02-27 13:19:18 +01:00
parent fc635f1014
commit c9b410fb35
No known key found for this signature in database
2 changed files with 11 additions and 3 deletions

View file

@ -47,7 +47,15 @@ func TestTagViewWithoutRelease(t *testing.T) {
// Test that the page loads
req := NewRequestf(t, "GET", "/%s/releases/tag/no-release", repo.FullName())
MakeRequest(t, req, http.StatusOK)
resp := MakeRequest(t, req, http.StatusOK)
// Test that the tags sub-menu is active
htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertElement(t, ".small-menu-items .active.item[href*='/tags']", true)
// Test that the release sub-menu isn't active
releaseLink := htmlDoc.Find(".small-menu-items .item[href*='/releases']")
assert.False(t, releaseLink.HasClass("active"))
}
func TestCreateNewTagProtected(t *testing.T) {