mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
feat: show breadcrumb path in path filtered commit history view (#12116)
Resolves forgejo/forgejo#8754 Add the breadcrumb path that already exists when browsing directories to the commit history of files/directories. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12116 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
parent
75cfa31af5
commit
254a44b97b
7 changed files with 44 additions and 18 deletions
|
|
@ -24,6 +24,7 @@ func testRepoCommitsSearch(t *testing.T, query, commit string) {
|
|||
doc := NewHTMLParser(t, resp.Body)
|
||||
sel := doc.doc.Find("#commits-table tbody tr td.sha a")
|
||||
assert.Equal(t, commit, strings.TrimSpace(sel.Text()))
|
||||
doc.AssertElement(t, ".repo-path", false)
|
||||
}
|
||||
|
||||
func TestRepoCommitsSearch(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ func TestRepoCommits(t *testing.T) {
|
|||
commitURL, exists := doc.doc.Find("#commits-table tbody tr td.sha a").Attr("href")
|
||||
assert.True(t, exists)
|
||||
assert.NotEmpty(t, commitURL)
|
||||
doc.AssertElement(t, ".repo-path", false)
|
||||
}
|
||||
|
||||
func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ func TestCommitListActions(t *testing.T) {
|
|||
[]*files_service.ChangeRepoFile{
|
||||
{
|
||||
Operation: "create",
|
||||
TreePath: "test.sh",
|
||||
TreePath: "test/test.sh",
|
||||
ContentReader: strings.NewReader("Hello there!"),
|
||||
},
|
||||
},
|
||||
|
|
@ -162,7 +162,7 @@ func TestCommitListActions(t *testing.T) {
|
|||
htmlDoc.AssertElement(t, fmt.Sprintf(".commit-list a[href^='/%s/src/commit/']", repo.FullName()), false)
|
||||
})
|
||||
|
||||
fileDiffSelector := fmt.Sprintf(".commit-list a[href='/%s/commit/%s?files=test.sh']", repo.FullName(), commitID)
|
||||
fileDiffSelector := fmt.Sprintf(".commit-list a[href='/%s/commit/%s?files=test/test.sh']", repo.FullName(), commitID)
|
||||
t.Run("Commit list", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
|
|
@ -177,12 +177,19 @@ func TestCommitListActions(t *testing.T) {
|
|||
t.Run("File history", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", repo.Link()+"/commits/branch/main/test.sh")
|
||||
req := NewRequest(t, "GET", repo.Link()+"/commits/branch/main/test/test.sh")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
htmlDoc.AssertElement(t, fmt.Sprintf(".commit-list a[href='/%s/src/commit/%s/test.sh']", repo.FullName(), commitID), true)
|
||||
htmlDoc.AssertElement(t, fmt.Sprintf(".commit-list a[href='/%s/src/commit/%s/test/test.sh']", repo.FullName(), commitID), true)
|
||||
htmlDoc.AssertElement(t, fileDiffSelector, true)
|
||||
|
||||
htmlDoc.AssertElement(t, ".repo-path", true)
|
||||
htmlDoc.AssertElement(t, fmt.Sprintf(".repo-path a[href='/%s/src/branch/main'][title='%s']", repo.FullName(), repo.Name), true)
|
||||
assert.Equal(t, 2, htmlDoc.Find(".repo-path .breadcrumb-divider").Length())
|
||||
htmlDoc.AssertElement(t, fmt.Sprintf(".repo-path .section a[href='/%s/src/branch/main/test'][title='test']", repo.FullName()), true)
|
||||
htmlDoc.AssertElement(t, ".repo-path .active[title='test.sh']", true)
|
||||
htmlDoc.AssertElement(t, ".repo-path button[data-clipboard-text='test/test.sh']", true)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue