1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
test_description='Check the markup hooks a theme relies on'
. ./setup.sh
test_expect_success 'set up a repository with a file that has an extension' '
mkrepo repos/hooks 2 &&
(
cd repos/hooks &&
mkdir dir &&
echo "int x;" >dir/hello.c &&
git add dir &&
git commit -m sources
) &&
{
echo "virtual-root=/" &&
echo "cache-size=0" &&
echo "enable-blame=1" &&
echo "max-stats=year" &&
echo "readme=:file-1" &&
echo "repo.url=hooks" &&
echo "repo.path=$PWD/repos/hooks/.git"
} >hooksrc
'
hooks() { CGIT_CONFIG="$PWD/hooksrc" QUERY_STRING="url=$1" cgit; }
test_expect_success 'the root names the page and the repository' '
hooks "" >tmp &&
grep "<div id=.cgit. data-page=.repolist.>" tmp &&
hooks "hooks/log/" >tmp &&
grep "<div id=.cgit. data-page=.log. data-repo=.hooks.>" tmp
'
test_expect_success 'the landmarks and the search form are in place' '
grep "<header id=.header.>" tmp &&
grep "<nav class=.tabs. aria-label=.Pages.>" tmp &&
grep "<form class=.search. role=.search." tmp &&
grep "<main class=.content.>" tmp &&
grep "<footer class=.footer.>" tmp
'
test_expect_success 'the listings name themselves, their sections and their rows' '
grep "<table class=.list log. aria-label=.Commits.>" tmp &&
grep "<tbody class=.log.>" tmp &&
grep "<tr class=.commit.>" tmp &&
grep "class=.active. aria-current=.page." tmp &&
grep "<th class=.left. scope=.col.>" tmp &&
hooks "" >tmp &&
grep "<table class=.list repolist. aria-label=.Repositories.>" tmp &&
grep "<tbody class=.repos.>" tmp &&
grep "<tr class=.repo.>" tmp &&
hooks "hooks/" >tmp &&
grep "<table class=.list summary. aria-label=.Summary.>" tmp &&
grep "<tbody class=.branches.>" tmp &&
grep "<tr class=.branch.>" tmp &&
hooks "hooks/tree/" >tmp &&
grep "<table class=.list tree. aria-label=.Files.>" tmp &&
grep "<tr class=.dir.>" tmp &&
grep "<tr class=.blob.>" tmp &&
hooks "hooks/tree/dir/" >tmp &&
grep "class=.ls-blob ext-c." tmp
'
test_expect_success 'the diff pages wrap each file and label their controls' '
hooks "hooks/commit/" >tmp &&
grep "<table class=.commit-info.>" tmp &&
grep "<th scope=.row.>author</th>" tmp &&
grep "<div class=.file. data-path=.dir/hello.c.>" tmp &&
grep "<label for=.diff-context.>" tmp &&
grep "<select id=.diff-context. name=.context.>" tmp &&
grep "<form method=.get. aria-label=.Diff options.>" tmp &&
hooks "hooks/diff/&ss=1" >tmp &&
grep "<tbody class=.file. data-path=.dir/hello.c.>" tmp &&
hooks "hooks/stats/" >tmp &&
grep "<label for=.stats-authors.>" tmp
'
test_expect_success 'the blob, blame and about pages open with their own containers' '
hooks "hooks/tree/dir/hello.c" >tmp &&
grep "<div class=.blob-header.>" tmp &&
grep "<a id=.n1." tmp &&
hooks "hooks/blame/dir/hello.c" >tmp &&
grep "<div class=.blob-header.>" tmp &&
hooks "hooks/about/" >tmp &&
grep "<div id=.about.>" tmp
'
test_expect_success 'the stylesheet and the script name only the current hooks' '
! grep "_dark\|#summary\|ul.pager\|td:empty" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.css" &&
grep "window.cgit.updateAges" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js" &&
grep "window.cgit.highlightLines" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js"
'
test_done
|