File 0856-common_test-Color-failing-line-in-test-suite-HTML-so.patch of Package erlang

From 30e0efdd1cef4bdf2622b5e1bb5c909952ef8c2e Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Thu, 30 Nov 2023 13:36:22 +0100
Subject: [PATCH] common_test: Color failing line in test suite HTML source
 file

If the URL has an anchor part at the end (# with line number),
color that line to make it easier to find on the screen.
---
 lib/common_test/src/erl2html2.erl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/common_test/src/erl2html2.erl b/lib/common_test/src/erl2html2.erl
index cb000bafd6..05cb807ec4 100644
--- a/lib/common_test/src/erl2html2.erl
+++ b/lib/common_test/src/erl2html2.erl
@@ -274,7 +274,13 @@ possibly_enhance(Str,false) ->
 %%%-----------------------------------------------------------------
 %%% End of the file
 footer() ->
-    "".
+    %% If the URL has an anchor part at the end (# with line number),
+    %% color that line to make it easier to find on the screen.
+    "<script>\n"
+    "var hash = window.location.hash.substring(1);\n"
+    "var anchor = document.getElementsByName(hash);\n"
+    "anchor[0].style.backgroundColor=\"orange\";\n"
+    "</script>\n".
 
 %%%-----------------------------------------------------------------
 %%% Read encoding from source file
-- 
2.35.3

openSUSE Build Service is sponsored by