Skip to content
Snippets Groups Projects

F 344 extern linkify absorbs commas etc into link adress

1 file
+ 14
14
Compare changes
  • Side-by-side
  • Inline
@@ -51,12 +51,12 @@ QUnit.test("custom datetime", function (assert) {
const text_value = $(`<span class="caosdb-f-property-datetime-value">${test_case[0]}</span>`);
container.append(text_value);
assert.equal($(container).find(" ").length, 0, "Test original datetime.");
cosmetics.custom_datetime();
const newValueElement =
cosmetics.custom_datetime();
const newValueElement =
container[0].querySelector("span.caosdb-v-property-datetime-customized-newvalue");
assert.ok(newValueElement, "Datetime customization: Test if result exists.");
assert.equal(newValueElement.innerHTML, test_case[1],
"Datetime customization: compared result.");
assert.ok(newValueElement, "Datetime customization: Test if result exists.");
assert.equal(newValueElement.innerHTML, test_case[1],
"Datetime customization: compared result.");
container.remove();
}
});
@@ -64,22 +64,22 @@ QUnit.test("custom datetime", function (assert) {
QUnit.test("linkify - https", function (assert) {
assert.ok(cosmetics.linkify, "linkify available");
var test_cases = [
["https://link", 1],
["this is other text https://link", 1],
["https://link this is other text", 1],
["this is other text https://link and this as well", 1],
["this is other text https://link", 1],
["this is other text https://link and here comes another link https://link and more text", 2],
["https://link", 1, "https://link",],
["this is other text https://link.com", 1, "https://link.com"],
["https://link; this is other text", 1, "https://link"],
["this is other text https://link.de and this as well", 1, "https://link.de"],
["this is other text https://link:3000", 1, "https://link:3000"],
["this is other text https://link.org/test, and here comes another link https://link.org/test and more text", 2, "https://link.org/test"],
];
for (let test_case of test_cases) {
const container = $('<div></div>');
var 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[href='https://link']").length, 0, "no link present");
assert.equal($(container).find(`a[href='${test_case[2]}']`).length, 0, "no link present");
cosmetics.linkify();
assert.equal($(container).find("a[href='https://link']").length, test_case[1], "link is present");
assert.equal($(container).find(`a[href='${test_case[2]}']`).length, test_case[1], `link is present: ${$(container)[0].outerHTML}`);
container.remove();
}
});
Loading