mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 05:52:10 +00:00
[UI] Remove unnecessary vertical space in empty labels list
- Don't show the labels-list element, if no labels are selected.
- The labels-list was taking up vertical space, even if no labels were
selected which caused an inconsistency in how the sidebar looked.
- Adds integration test
(cherry picked from commit 013b89eb13
)
This commit is contained in:
parent
118b8eb9c1
commit
b2d3ae4dc0
|
@ -1,5 +1,6 @@
|
||||||
<div class="ui labels list">
|
<div class="ui labels list">
|
||||||
<span class="no-select item {{if .root.HasSelectedLabel}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span>
|
<span class="no-select item {{if .root.HasSelectedLabel}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span>
|
||||||
|
{{if .root.HasSelectedLabel}}
|
||||||
<span class="labels-list">
|
<span class="labels-list">
|
||||||
{{range .root.Labels}}
|
{{range .root.Labels}}
|
||||||
{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
|
{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
|
||||||
|
@ -8,4 +9,5 @@
|
||||||
{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
|
{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -939,3 +939,32 @@ func TestIssueUnsubscription(t *testing.T) {
|
||||||
session.MakeRequest(t, req, http.StatusOK)
|
session.MakeRequest(t, req, http.StatusOK)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssueLabelList(t *testing.T) {
|
||||||
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
labelListSelector := ".labels.list .labels-list"
|
||||||
|
hiddenClass := "tw-hidden"
|
||||||
|
|
||||||
|
t.Run("Show label list", func(t *testing.T) {
|
||||||
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
|
req := NewRequest(t, "GET", "/user2/repo1/issues/1")
|
||||||
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
|
||||||
|
htmlDoc.AssertElement(t, labelListSelector, true)
|
||||||
|
htmlDoc.AssertElement(t, ".labels.list .no-select.item."+hiddenClass, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("Show no label list", func(t *testing.T) {
|
||||||
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
session := loginUser(t, "user2")
|
||||||
|
|
||||||
|
req := NewRequest(t, "GET", "/user2/repo2/issues/1")
|
||||||
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
|
||||||
|
htmlDoc.AssertElement(t, labelListSelector, false)
|
||||||
|
htmlDoc.AssertElement(t, ".labels.list .no-select.item:not([class*='"+hiddenClass+"'])", true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue