Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test the settings that change the logo
| -rwxr-xr-x | tests/t0005-markup.sh | 38 |
1 file changed, 33 insertions, 5 deletions
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh index c05f404..e1da677 100755 --- a/tests/t0005-markup.sh +++ b/tests/t0005-markup.sh @@ -136,11 +136,39 @@ test_expect_success 'a pinned page names its commit before the repository' ' grep "<title>hooks @ $old - $site</title>" tmp ' -# The logo is all its link holds, so it is named for where the link leads, -# which by default is the site's index. -test_expect_success 'the logo is named after the site' ' - cgit_rc hooksrc "url=hooks/" >tmp && - grep "<a class=.logo. href=./.><img src=./cgit.png. alt=.$site.></a>" 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' ' + cgit_ok hooksrc "url=hooks/" >tmp && + test_grep "<a class=.logo. href=./.><img src=./cgit.png. alt=.$site.></a>" tmp && + { + echo "logo-link=https://example.org/" && + cat hooksrc + } >logorc && + cgit_ok logorc "url=hooks/" >tmp && + test_grep "<a class=.logo. href=.https://example.org/.><img src=./cgit.png. alt=.$site.></a>" tmp +' + +test_expect_success 'a repository logo stands in on its own pages' ' + { + cat hooksrc && + echo "repo.logo=/hooks.png" + } >logorc && + cgit_ok logorc "url=hooks/" >tmp && + test_grep "<a class=.logo. href=./.><img src=./hooks.png. alt=.$site.></a>" tmp && + cgit_ok logorc "url=" >tmp && + test_grep "<a class=.logo. href=./.><img src=./cgit.png. alt=.$site.></a>" tmp +' + +test_expect_success 'an empty logo leaves the header without one' ' + { + echo "logo=" && + cat hooksrc + } >logorc && + cgit_ok logorc "url=hooks/" >tmp && + test_grep "<header id=.header.>" tmp && + test_grep ! "class=.logo." tmp && + test_grep ! "<img" tmp ' test_expect_success 'an error page names the error where a page names itself' ' |
