-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
3 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,100 +307,4 @@ test.describe('Auto Links', () => { | |
{ignoreClasses: true}, | ||
); | ||
}); | ||
|
||
test(`Does not convert bad URLs into links`, async ({page, isPlainText}) => { | ||
const badUrls = [ | ||
'http://', | ||
'http://.', | ||
'http://..', | ||
'http://../', | ||
'http://?', | ||
'http://??', | ||
'http://??/', | ||
'http://#', | ||
'http://##', | ||
'http://##/', | ||
'//', | ||
'//a', | ||
'///a', | ||
'///', | ||
'http:///a', | ||
'rdar://1234', | ||
'h://test', | ||
':// should fail', | ||
'http://foo.bar/foo(bar)baz quux', | ||
'http://-error-.invalid/', | ||
'http://-a.b.co', | ||
'http://a.b-.co', | ||
'http://ex..ample.com', | ||
'http://example..com', | ||
'http://example-.com', | ||
'http://-example.com', | ||
]; | ||
|
||
test.skip(isPlainText); | ||
await focusEditor(page); | ||
await page.keyboard.type(badUrls.join(' ')); | ||
|
||
await assertHTML( | ||
page, | ||
html` | ||
<p dir="ltr"> | ||
<span data-lexical-text="true">${badUrls.join(' ')}</span> | ||
</p> | ||
`, | ||
undefined, | ||
{ignoreClasses: true}, | ||
); | ||
}); | ||
|
||
test('Does convert good complex URLs into links', async ({ | ||
page, | ||
isPlainText, | ||
}) => { | ||
const goodUrls = [ | ||
'http://foo.com/blah_blah', | ||
'http://foo.com/blah_blah/', | ||
'http://www.example.com/wpstyle/?p=364', | ||
'https://www.example.com/foo/?bar=baz&inga=42&quux', | ||
'http://foo.com/something?after=parens', | ||
'http://jlo.mp', | ||
'http://1337.net', | ||
'http://a.b-c.de', | ||
// // Include IPs and localhost | ||
'http://localhost', | ||
'http://localhost:3000', | ||
'http://192.168.1.1', | ||
'http://192.168.1.1:3000', | ||
'http://example.com', | ||
'http://example.com/path/to/resource?query=string#fragment', | ||
'https://username:[email protected]', | ||
'http://example.com/path/to/page.html?query=string#fragment', | ||
'https://example.com#anchor', | ||
'http://abcdefghij.com', | ||
]; | ||
|
||
test.skip(isPlainText); | ||
await focusEditor(page); | ||
await page.keyboard.type(goodUrls.join(' ') + ' '); | ||
|
||
let expectedHTML = ''; | ||
for (const url of goodUrls) { | ||
expectedHTML += ` | ||
<a href="${url.replaceAll(/&/g, '&')}" dir="ltr"> | ||
<span data-lexical-text="true">${url.replace(/&/g, '&')}</span> | ||
</a> | ||
<span data-lexical-text="true"></span> | ||
`; | ||
} | ||
|
||
await assertHTML( | ||
page, | ||
html` | ||
<p dir="ltr">${expectedHTML}</p> | ||
`, | ||
undefined, | ||
{ignoreClasses: true}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fd254be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lexical – ./packages/lexical-website
lexical-git-main-fbopensource.vercel.app
lexical-fbopensource.vercel.app
lexicaljs.com
lexicaljs.org
lexical.dev
www.lexical.dev
fd254be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lexical-playground – ./packages/lexical-playground
lexical-playground-git-main-fbopensource.vercel.app
lexical-playground-fbopensource.vercel.app
lexical-playground.vercel.app
playground.lexical.dev