Upgrade linkifyjs to fix schemes as domain prefixes (#7628)

This commit is contained in:
J. Ryan Stinnett 2022-01-25 17:37:54 +00:00 committed by GitHub
parent fad65f9582
commit 51a44f491e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 10 deletions

View file

@ -278,7 +278,7 @@ describe('linkify-matrix', () => {
});
describe('matrix uri', () => {
const AcceptedMatrixUris = [
const acceptedMatrixUris = [
'matrix:u/foo_bar:server.uk',
'matrix:r/foo-bar:server.uk',
'matrix:roomid/somewhere:example.org?via=elsewhere.ca',
@ -287,7 +287,7 @@ describe('linkify-matrix', () => {
'matrix:roomid/somewhere:example.org/e/event?via=elsewhere.ca',
'matrix:u/alice:example.org?action=chat',
];
for (const matrixUri of AcceptedMatrixUris) {
for (const matrixUri of acceptedMatrixUris) {
it('accepts ' + matrixUri, () => {
const test = matrixUri;
const found = linkify.find(test);
@ -302,4 +302,27 @@ describe('linkify-matrix', () => {
});
}
});
describe("matrix-prefixed domains", () => {
const acceptedDomains = [
'matrix.org',
'matrix.to',
'matrix-help.org',
'matrix123.org',
];
for (const domain of acceptedDomains) {
it('accepts ' + domain, () => {
const test = domain;
const found = linkify.find(test);
expect(found).toEqual(([{
href: `http://${domain}`,
type: Type.URL,
value: domain,
end: domain.length,
start: 0,
isLink: true,
}]));
});
}
});
});