Update linkify to 4.1.1 (#11132)

* Update linkify to 4.1.1

Fixes: vector-im/element-web#23806

* Empty commit to nudge CI

* Remove obsolete `any` types

* Allow hyphens in domainpart

* Improve test name
This commit is contained in:
Johannes Marbach 2023-06-27 13:23:37 +02:00 committed by GitHub
parent 79a7b9aedc
commit bde51ae524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 67 deletions

View file

@ -138,6 +138,20 @@ describe("linkify-matrix", () => {
},
]);
});
it("properly parses " + char + "localhost:foo.com", () => {
const test = char + "localhost:foo.com";
const found = linkify.find(test);
expect(found).toEqual([
{
href: char + "localhost:foo.com",
type,
value: char + "localhost:foo.com",
start: 0,
end: test.length,
isLink: true,
},
]);
});
it("properly parses " + char + "foo:localhost", () => {
const test = char + "foo:localhost";
const found = linkify.find(test);
@ -162,7 +176,6 @@ describe("linkify-matrix", () => {
value: char + "foo:bar.com",
start: 0,
end: test.length,
isLink: true,
},
]);
@ -219,7 +232,6 @@ describe("linkify-matrix", () => {
href: char + "foo:bar.com",
start: 0,
end: test.length - ":".length,
isLink: true,
},
]);
@ -238,6 +250,20 @@ describe("linkify-matrix", () => {
},
]);
});
it("ignores duplicate :NUM (double port specifier)", () => {
const test = "" + char + "foo:bar.com:2225:1234";
const found = linkify.find(test);
expect(found).toEqual([
{
href: char + "foo:bar.com:2225",
type,
value: char + "foo:bar.com:2225",
start: 0,
end: 17,
isLink: true,
},
]);
});
it("ignores all the trailing :", () => {
const test = "" + char + "foo:bar.com::::";
const found = linkify.find(test);
@ -262,7 +288,6 @@ describe("linkify-matrix", () => {
value: char + "foo.asdf:bar.com",
start: 0,
end: test.length - ":".repeat(4).length,
isLink: true,
},
]);
@ -281,7 +306,7 @@ describe("linkify-matrix", () => {
},
]);
});
it("does not parse multiple room aliases in one string", () => {
it("properly parses room alias with hyphen in domain part", () => {
const test = "" + char + "foo:bar.com-baz.com";
const found = linkify.find(test);
expect(found).toEqual([