summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/repo_test.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/integration/repo_test.go b/tests/integration/repo_test.go
index f165cae539..90fc19c193 100644
--- a/tests/integration/repo_test.go
+++ b/tests/integration/repo_test.go
@@ -1009,16 +1009,29 @@ func TestRepoCodeSearchForm(t *testing.T) {
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
- action, exists := htmlDoc.doc.Find("form[data-test-tag=codesearch]").Attr("action")
- assert.True(t, exists)
+ formEl := htmlDoc.doc.Find("form[data-test-tag=codesearch]")
+ action, exists := formEl.Attr("action")
+ assert.True(t, exists)
branchSubURL := "/branch/master"
-
if indexer {
assert.NotContains(t, action, branchSubURL)
} else {
assert.Contains(t, action, branchSubURL)
}
+
+ filepath, exists := formEl.Find("input[name=path]").Attr("value")
+ assert.True(t, exists)
+ assert.Empty(t, filepath)
+
+ req = NewRequest(t, "GET", "/user2/glob/src/branch/master/x/y")
+ resp = MakeRequest(t, req, http.StatusOK)
+
+ filepath, exists = NewHTMLParser(t, resp.Body).doc.
+ Find("form[data-test-tag=codesearch] input[name=path]").
+ Attr("value")
+ assert.True(t, exists)
+ assert.Equal(t, "x/y", filepath)
}
t.Run("indexer disabled", func(t *testing.T) {