From e1dee1d613d76a45083667b359dd63f8d13759b4 Mon Sep 17 00:00:00 2001 From: Vishesh Verma <vermavishesh023@gmail.com> Date: Thu, 17 Oct 2024 11:00:55 +0000 Subject: [PATCH] Update file ext_cosmetics.js.js --- test/core/js/modules/ext_cosmetics.js.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/core/js/modules/ext_cosmetics.js.js b/test/core/js/modules/ext_cosmetics.js.js index 14b7eaad..2daf8881 100644 --- a/test/core/js/modules/ext_cosmetics.js.js +++ b/test/core/js/modules/ext_cosmetics.js.js @@ -119,3 +119,23 @@ QUnit.test("linkify cut-off (40)", function (assert) { container.remove(); }); + +QUnit.test("linkify - double values in URLs", function (assert) { + var test_cases = [ + ["https://example.com/value=1.2345", 1], + ["This is a URL with a double value: https://example.com/value=1.2345", 1], + ["https://example.com?param=123.456&other=789.1011", 1], + ["Multiple links with doubles: https://example.com?param=1.1 and https://example2.com?param=2.2", 2], + ]; + + for (let test_case of test_cases) { + const container = $('<div></div>'); + $(document.body).append(container); + const text_value = $(`<div class="caosdb-f-property-text-value">${test_case[0]}</div>`); + container.append(text_value); + assert.equal($(container).find("a").length, 0, "no link present"); + cosmetics.linkify(); + assert.equal($(container).find("a").length, test_case[1], "link is present"); + container.remove(); + } +}); -- GitLab