Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test the index title and a repository's own name
Diffstat (limited to 'tests/t0005-markup.sh')
| -rwxr-xr-x | tests/t0005-markup.sh | 27 |
1 file changed, 26 insertions, 1 deletion
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh index e1da677..f5034f0 100755 --- a/tests/t0005-markup.sh +++ b/tests/t0005-markup.sh @@ -21,6 +21,7 @@ test_expect_success 'set up a repository with a file that has an extension' ' git add dir && git commit -m sources ) && + old=$(git -C repos/hooks rev-parse HEAD~1 | cut -c1-10) && cgitrc_repo hooksrc hooks enable-blame=1 max-stats=year readme=:file-1 \ "root-title=$site" ' @@ -127,7 +128,6 @@ test_expect_success 'each page names itself, then the repository and the site' ' # A commit the page is pinned to belongs with the page's own name, or with the # repository's on the summary, which has no name of its own. test_expect_success 'a pinned page names its commit before the repository' ' - old=$(git -C repos/hooks rev-parse HEAD~1 | cut -c1-10) && cgit_rc hooksrc "url=hooks/tree/&id=$old" >tmp && grep "<title>tree @ $old - hooks - $site</title>" tmp && cgit_rc hooksrc "url=hooks/commit/&id=$old" >tmp && @@ -136,6 +136,31 @@ test_expect_success 'a pinned page names its commit before the repository' ' grep "<title>hooks @ $old - $site</title>" tmp ' +test_expect_success 'the index is named after the site alone' ' + cgit_ok hooksrc "url=" >tmp && + test_grep "<title>$site</title>" tmp +' + +# A name set apart from the url is what the page shows wherever it names the +# repository, while data-repo keeps the url the README promises a theme. +test_expect_success 'a repository shows its name and keeps its url in data-repo' ' + { + cat hooksrc && + echo "repo.name=hook scripts" + } >namedrc && + cgit_ok namedrc "url=" >tmp && + test_grep "<td class=.col-name toplevel-repo.><a href=./hooks/.>hook scripts</a></td>" tmp && + cgit_ok namedrc "url=hooks/log/" >tmp && + test_grep "<div id=.cgit. data-page=.log. data-repo=.hooks.>" tmp && + test_grep "<title>log - hook scripts - $site</title>" tmp && + test_grep " : <a href=./hooks/.>hook scripts</a></h1>" tmp && + cgit_ok namedrc "url=hooks/tree/&id=$old" >tmp && + test_grep "<title>tree @ $old - hook scripts - $site</title>" tmp && + cgit_rc namedrc "url=hooks/tree/missing" >tmp && + test_grep "^Status: 404" tmp && + test_grep "<title>Not Found - hook scripts - $site</title>" tmp +' + # The logo is all its link holds, so it is named after the site, both on the # default link to the index and on a link logo-link sends elsewhere. test_expect_success 'the logo is named after the site wherever it links' ' |
