summaryrefslogtreecommitdiffstats
path: root/integrations/compare_test.go
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2021-12-06 11:04:07 -0600
committerGitHub <noreply@github.com>2021-12-06 11:04:07 -0600
commiteb69c7ec8c1f732c67978355f6efff1f7dfe2fac (patch)
treeb5316bde870689751c3167b75f1d6463c3fb13a7 /integrations/compare_test.go
parent12a42baa5ed5f5b5224f7c775b8be04b3eb4980c (diff)
downloadgitea-eb69c7ec8c1f732c67978355f6efff1f7dfe2fac.tar.gz
gitea-eb69c7ec8c1f732c67978355f6efff1f7dfe2fac.zip
Allow default branch to be inferred on compare page (#17908)
* Allow default branch to be inferred Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add test for inferred default branch Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'integrations/compare_test.go')
-rw-r--r--integrations/compare_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/integrations/compare_test.go b/integrations/compare_test.go
index e8efe7cd09..0fb2ae6c91 100644
--- a/integrations/compare_test.go
+++ b/integrations/compare_test.go
@@ -27,3 +27,15 @@ func TestCompareTag(t *testing.T) {
resp = session.MakeRequest(t, req, http.StatusNotFound)
assert.False(t, strings.Contains(resp.Body.String(), "/assets/img/500.png"), "expect 404 page not 500")
}
+
+// Compare with inferred default branch (master)
+func TestCompareDefault(t *testing.T) {
+ defer prepareTestEnv(t)()
+
+ session := loginUser(t, "user2")
+ req := NewRequest(t, "GET", "/user2/repo1/compare/v1.1")
+ resp := session.MakeRequest(t, req, http.StatusOK)
+ htmlDoc := NewHTMLParser(t, resp.Body)
+ selection := htmlDoc.doc.Find(".choose.branch .filter.dropdown")
+ assert.Lenf(t, selection.Nodes, 2, "The template has changed")
+}