Skip to content

Commit 43e7745

Browse files
committed
add tests
1 parent eb2a642 commit 43e7745

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modules/templates/util_render_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ func TestRenderLabels(t *testing.T) {
209209
expectedLabel := `<a href="&lt;&gt;" class="ui label " style="color: #fff !important; background-color: label-color !important;" data-tooltip-content title=""><span class="gt-ellipsis">label-name</span></a>`
210210
assert.Equal(t, expectedLabel, string(ut.RenderLabelWithLink(label, "<>")))
211211
assert.Equal(t, expectedLabel, string(ut.RenderLabelWithLink(label, template.URL("<>"))))
212+
213+
label = &issues.Label{ID: 123, Name: "</>", Exclusive: true}
214+
expectedLabel = `<a href="" class="ui label scope-parent" data-tooltip-content title=""><div class="ui label scope-left" style="color: #fff !important; background-color: #000000 !important">&lt;</div><div class="ui label scope-right" style="color: #fff !important; background-color: #000000 !important">&gt;</div></a>`
215+
assert.Equal(t, expectedLabel, string(ut.RenderLabelWithLink(label, "")))
216+
label = &issues.Label{ID: 123, Name: "</>", Exclusive: true, ExclusiveOrder: 1}
217+
expectedLabel = `<a href="" class="ui label scope-parent" data-tooltip-content title=""><div class="ui label scope-left" style="color: #fff !important; background-color: #000000 !important">&lt;</div><div class="ui label scope-middle" style="color: #fff !important; background-color: #000000 !important">&gt;</div><div class="ui label scope-right">1</div></a>`
218+
assert.Equal(t, expectedLabel, string(ut.RenderLabelWithLink(label, "")))
212219
}
213220

214221
func TestUserMention(t *testing.T) {

0 commit comments

Comments
 (0)