diff options
Diffstat (limited to 'tests/t0005-markup.sh')
-rwxr-xr-xtests/t0005-markup.sh73
1 file changed, 73 insertions, 0 deletions
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh
index 2a8d572..bbf78b1 100755
--- a/tests/t0005-markup.sh
+++ b/tests/t0005-markup.sh
@@ -96,4 +96,77 @@ test_expect_success 'the stylesheet and the script name only the current hooks'
grep "window.cgit.highlightLines" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js"
'
+# The rest of the hooks need a tag, a symlink, a submodule, a trailer, clone
+# urls and a second page of repositories, so they get a commit and a config
+# of their own after the checks above have read the first ones.
+test_expect_success 'set up the remaining kinds of entry' '
+ (
+ cd repos/hooks &&
+ git tag -a -m "first release" v1 &&
+ test_ln_s_add file-1 link &&
+ git update-index --add --cacheinfo "160000,$(git rev-parse HEAD),sub" &&
+ git commit -m "more kinds of entry" -m "Fixes: $(git rev-parse --short HEAD)"
+ ) &&
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "enable-commit-trailers=1" &&
+ echo "max-repo-count=1" &&
+ echo "clone-url=https://example.com/clone.git" &&
+ echo "repo.url=hooks" &&
+ echo "repo.path=$PWD/repos/hooks/.git" &&
+ echo "repo.url=again" &&
+ echo "repo.path=$PWD/repos/hooks/.git"
+ } >morerc
+'
+
+more() { CGIT_CONFIG="$PWD/morerc" QUERY_STRING="url=$1" cgit; }
+
+test_expect_success 'the refs, summary and tree name every section and row' '
+ more "hooks/refs/" >tmp &&
+ grep "<table class=.list refs. aria-label=.Branches and tags.>" tmp &&
+ grep "<tbody class=.tags.>" tmp &&
+ grep "<tr class=.tag.>" tmp &&
+ more "hooks/" >tmp &&
+ grep "<tbody class=.clone.>" tmp &&
+ more "hooks/tree/" >tmp &&
+ grep "<tbody class=.tree.>" tmp &&
+ grep "<tr class=.link.>" tmp &&
+ grep "<tr class=.mod.>" tmp
+'
+
+test_expect_success 'the commit page has its trailer table and diffstat' '
+ more "hooks/commit/" >tmp &&
+ grep "<table class=.commit-trailers.>" tmp &&
+ grep "<table class=.diffstat.>" tmp
+'
+
+test_expect_success 'the breadcrumb, the pager and the ages carry their hooks' '
+ more "hooks/tree/dir/" >tmp &&
+ grep "<nav class=.path. aria-label=.breadcrumb.>" tmp &&
+ more "" >tmp &&
+ grep "<nav class=.pager. aria-label=.Pager.>" tmp &&
+ grep "class=.current. aria-current=.page." tmp &&
+ grep "<time class=.age-[a-z]*. datetime=.[^ ]* data-ut=.[0-9]*." tmp
+'
+
+test_expect_success 'a date shown in full is a plain time element' '
+ {
+ echo "enable-relative-dates=0" &&
+ cat morerc
+ } >fullrc &&
+ CGIT_CONFIG="$PWD/fullrc" QUERY_STRING="url=" cgit >tmp &&
+ grep "<time datetime=" tmp &&
+ ! grep "data-ut=" tmp
+'
+
+test_expect_success 'embedded mode marks the root' '
+ {
+ echo "embedded=1" &&
+ cat hooksrc
+ } >embeddedrc &&
+ CGIT_CONFIG="$PWD/embeddedrc" QUERY_STRING="url=hooks/" cgit >tmp &&
+ grep "<div id=.cgit. class=.cgit-embedded. data-page=.summary." tmp
+'
+
test_done