Skip to content

Commit 2102d65

Browse files
committed
fix test
1 parent d01f7eb commit 2102d65

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

templates/repo/clone_buttons.tmpl

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
<!-- there is always at least one button (by context/repo.go) -->
1+
<!-- there is always at least one button (guaranteed by context/repo.go) -->
22
<div class="ui action small input clone-buttons-combo">
33
{{if $.CloneButtonShowHTTPS}}
4-
<button class="ui small button repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}">
5-
HTTPS
6-
</button>
4+
<button class="ui small button repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}">HTTPS</button>
75
{{end}}
86
{{if $.CloneButtonShowSSH}}
9-
<button class="ui small button repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">
10-
SSH
11-
</button>
7+
<button class="ui small button repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">SSH</button>
128
{{end}}
139
<input size="10" class="repo-clone-url js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly>
14-
<button class="ui small icon button" data-clipboard-target=".repo-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" aria-label="{{ctx.Locale.Tr "copy_url"}}">
10+
<button class="ui small icon button" data-clipboard-target=".repo-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}">
1511
{{svg "octicon-copy" 14}}
1612
</button>
1713
</div>

templates/repo/clone_panel.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="clone-panel-field">
2020
<div class="ui input tiny action">
2121
<input size="30" class="repo-clone-url js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly>
22-
<div class="ui small compact icon button" data-clipboard-target=".js-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" aria-label="{{ctx.Locale.Tr "copy_url"}}">
22+
<div class="ui small compact icon button" data-clipboard-target=".js-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}">
2323
{{svg "octicon-copy" 14}}
2424
</div>
2525
</div>

tests/integration/repo_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ func TestViewRepo1CloneLinkAnonymous(t *testing.T) {
127127
resp := MakeRequest(t, req, http.StatusOK)
128128

129129
htmlDoc := NewHTMLParser(t, resp.Body)
130-
link, exists := htmlDoc.doc.Find("#repo-clone-https").Attr("data-link")
130+
link, exists := htmlDoc.doc.Find(".repo-clone-https").Attr("data-link")
131131
assert.True(t, exists, "The template has changed")
132132
assert.Equal(t, setting.AppURL+"user2/repo1.git", link)
133-
_, exists = htmlDoc.doc.Find("#repo-clone-ssh").Attr("data-link")
133+
_, exists = htmlDoc.doc.Find(".repo-clone-ssh").Attr("data-link")
134134
assert.False(t, exists)
135135
}
136136

@@ -143,10 +143,10 @@ func TestViewRepo1CloneLinkAuthorized(t *testing.T) {
143143
resp := session.MakeRequest(t, req, http.StatusOK)
144144

145145
htmlDoc := NewHTMLParser(t, resp.Body)
146-
link, exists := htmlDoc.doc.Find("#repo-clone-https").Attr("data-link")
146+
link, exists := htmlDoc.doc.Find(".repo-clone-https").Attr("data-link")
147147
assert.True(t, exists, "The template has changed")
148148
assert.Equal(t, setting.AppURL+"user2/repo1.git", link)
149-
link, exists = htmlDoc.doc.Find("#repo-clone-ssh").Attr("data-link")
149+
link, exists = htmlDoc.doc.Find(".repo-clone-ssh").Attr("data-link")
150150
assert.True(t, exists, "The template has changed")
151151
sshURL := fmt.Sprintf("ssh://%s@%s:%d/user2/repo1.git", setting.SSH.User, setting.SSH.Domain, setting.SSH.Port)
152152
assert.Equal(t, sshURL, link)

0 commit comments

Comments
 (0)