Diff options
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0005-markup.sh8
1 file changed, 8 insertions, 0 deletions
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh
index 1a8c5f2..f93392d 100755
--- a/tests/t0005-markup.sh
+++ b/tests/t0005-markup.sh
@@ -168,6 +168,14 @@ test_expect_success 'the script walks the ages from a list that holds still' '
! grep "getElementsByClassName" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js"
'
+# The line anchors carry a scroll margin of half the window, which centres a
+# line scrolled to the top of the view. Asking scrollIntoView to centre it as
+# well centres the margin too and drops a range three quarters of the way down.
+test_expect_success 'a line range scrolls where a single line does' '
+ grep "^ scroll-margin-top: calc(50vh - 1em);$" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.css" &&
+ grep "first.scrollIntoView();" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js"
+'
+
# The rest of the hooks need a tag, a symlink, a submodule, a trailer, a lone
# carriage return, clone urls, an empty repository and a second page of
# repositories, so they get a commit and a config of their own after the checks