diff options
context:
space:
mode:
Diffstat (limited to 'tests/t0103-log.sh')
-rwxr-xr-xtests/t0103-log.sh20
1 file changed, 20 insertions, 0 deletions
diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh
index 41b9769..dfb5176 100755
--- a/tests/t0103-log.sh
+++ b/tests/t0103-log.sh
@@ -17,6 +17,26 @@ test_expect_success 'generate bar/log' 'cgit_url "bar/log" >tmp'
test_expect_success 'find commit 1' 'grep "commit 1" tmp'
test_expect_success 'find commit 50' 'grep "commit 50" tmp'
+# The switch button submits the select as h, so whatever head the request
+# follows has to sit in the list selected, or submitting would quietly move
+# the visitor to the first branch.
+test_expect_success 'a detached head stays selected in the switcher' '
+ sha=$(git -C repos/foo rev-parse master~1) &&
+ cgit_url "foo/log&h=$sha" >tmp &&
+ grep "option value=.$sha. selected" tmp
+'
+test_expect_success 'a tag head stays selected in the switcher' '
+ git -C repos/foo tag t-switch master~1 &&
+ cgit_url "foo/log&h=t-switch" >tmp &&
+ grep "option value=.t-switch. selected>t-switch (detached)" tmp &&
+ git -C repos/foo tag -d t-switch
+'
+test_expect_success 'a branch head keeps its plain option' '
+ cgit_url "foo/log&h=master" >tmp &&
+ grep "option value=.master. selected>master<" tmp &&
+ ! grep "detached" tmp
+'
+
test_expect_success 'generate "with%20space/log?qt=grep&q=commit+1"' '
cgit_url "with+space/log&qt=grep&q=commit+1" >tmp
'