summaryrefslogtreecommitdiffstats
path: root/integrations/repo_test.go
diff options
context:
space:
mode:
authorTris Forster <tris.git@tfconsulting.com.au>2018-05-01 17:04:36 +1000
committerLauris BH <lauris@nix.lv>2018-05-01 10:04:36 +0300
commit85d14cc229263c5788cac9370ac60e9582f9de6c (patch)
treecd8b7d9505335f86eddfdd3379afb21f414c00c0 /integrations/repo_test.go
parent1928920a08e038e1ec0f631b2f84f5610638209f (diff)
downloadgitea-85d14cc229263c5788cac9370ac60e9582f9de6c.tar.gz
gitea-85d14cc229263c5788cac9370ac60e9582f9de6c.zip
Symlink icons (#1416) (#3826)
* Updated vendor code for code.gitea.io/git * Display symlinks correctly for files and directories * Added symlink tests * Applied silverwinds stylesheet patch Signed-off-by: Tris Forster <tris.git@shoddynet.org>
Diffstat (limited to 'integrations/repo_test.go')
-rw-r--r--integrations/repo_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/integrations/repo_test.go b/integrations/repo_test.go
index a18bfabdf3..165009faa2 100644
--- a/integrations/repo_test.go
+++ b/integrations/repo_test.go
@@ -7,10 +7,12 @@ package integrations
import (
"fmt"
"net/http"
+ "strings"
"testing"
"code.gitea.io/gitea/modules/setting"
+ "github.com/PuerkitoBio/goquery"
"github.com/stretchr/testify/assert"
)
@@ -74,3 +76,26 @@ func TestViewRepo1CloneLinkAuthorized(t *testing.T) {
sshURL := fmt.Sprintf("ssh://%s@%s:%d/user2/repo1.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port)
assert.Equal(t, sshURL, link)
}
+
+func TestViewRepoWithSymlinks(t *testing.T) {
+ prepareTestEnv(t)
+
+ session := loginUser(t, "user2")
+
+ req := NewRequest(t, "GET", "/user2/repo20.git")
+ resp := session.MakeRequest(t, req, http.StatusOK)
+
+ htmlDoc := NewHTMLParser(t, resp.Body)
+ files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name")
+ items := files.Map(func(i int, s *goquery.Selection) string {
+ cls, _ := s.Find("SPAN").Attr("class")
+ file := strings.Trim(s.Find("A").Text(), " \t\n")
+ return fmt.Sprintf("%s: %s", file, cls)
+ })
+ assert.Equal(t, len(items), 5)
+ assert.Equal(t, items[0], "a: octicon octicon-file-directory")
+ assert.Equal(t, items[1], "link_b: octicon octicon-file-symlink-directory")
+ assert.Equal(t, items[2], "link_d: octicon octicon-file-symlink-file")
+ assert.Equal(t, items[3], "link_hi: octicon octicon-file-symlink-file")
+ assert.Equal(t, items[4], "link_link: octicon octicon-file-symlink-file")
+}