mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 08:21:11 +00:00 
			
		
		
		
	Merge pull request '[v8.0/forgejo] [UI] Remove unnecessary vertical space in empty labels list' (#4495) from bp-v8.0/forgejo-013b89e into v8.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4495 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
		
				commit
				
					
						9f7d1051a4
					
				
			
		
					 2 changed files with 39 additions and 8 deletions
				
			
		| 
						 | 
					@ -1,11 +1,13 @@
 | 
				
			||||||
<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>
 | 
				
			||||||
	<span class="labels-list">
 | 
						{{if .root.HasSelectedLabel}}
 | 
				
			||||||
		{{range .root.Labels}}
 | 
							<span class="labels-list">
 | 
				
			||||||
			{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
 | 
								{{range .root.Labels}}
 | 
				
			||||||
		{{end}}
 | 
									{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
 | 
				
			||||||
		{{range .root.OrgLabels}}
 | 
								{{end}}
 | 
				
			||||||
			{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
 | 
								{{range .root.OrgLabels}}
 | 
				
			||||||
		{{end}}
 | 
									{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
 | 
				
			||||||
	</span>
 | 
								{{end}}
 | 
				
			||||||
 | 
							</span>
 | 
				
			||||||
 | 
						{{end}}
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1126,3 +1126,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…
	
	Add table
		Add a link
		
	
		Reference in a new issue