Upgrade linkifyjs to fix schemes as domain prefixes (#7628)
This commit is contained in:
parent
fad65f9582
commit
51a44f491e
4 changed files with 33 additions and 10 deletions
|
@ -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,
|
||||
}]));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue