diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Show characters a browser breaks at as escapes
The HTML parser turns a carriage return with no line feed after it into a line feed, and WebKit starts a new line at U+2028 and U+2029, while git and the line numbers count line feeds alone, so each one set every later line of the tree and blame pages a line below its number. CSS Text makes vertical tab, form feed and next line forced breaks as well, though no engine honours that yet. The escapes follow gitweb, which shows control characters the same way.
Diffstat (limited to 'tests/t0005-markup.sh')
-rwxr-xr-xtests/t0005-markup.sh15
1 file changed, 11 insertions, 4 deletions
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh
index e3cb08d..829c839 100755
--- a/tests/t0005-markup.sh
+++ b/tests/t0005-markup.sh
@@ -96,15 +96,17 @@ 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, an empty repository 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.
+# 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
+# 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 &&
+ printf "a\\rb\\n" >cr.txt &&
+ git add cr.txt &&
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)"
) &&
@@ -139,6 +141,11 @@ test_expect_success 'the refs, summary and tree name every section and row' '
grep "<tr class=.mod.>" tmp
'
+test_expect_success 'a character the browser would break a line at is an escape' '
+ more "hooks/tree/cr.txt" >tmp &&
+ grep "a<span class=.escape.>" tmp
+'
+
test_expect_success 'the commit page has its trailer table and diffstat' '
more "hooks/commit/" >tmp &&
grep "<table class=.commit-trailers.>" tmp &&