-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5176 from nextcloud-libraries/fix/reference_url_p…
…attern fix(NcRichText): Make URL_PATTERN match localhost and URLs with ports
- Loading branch information
Showing
2 changed files
with
23 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { URL_PATTERN, URL_PATTERN_AUTOLINK } from '../../../../src/components/NcRichText/helpers.js' | ||
|
||
describe('URL_PATTERN', () => { | ||
const urls = [ | ||
'http://example.org', | ||
'https://example.org/', | ||
'https://cloud.example.org/index.php/apps/files/', | ||
'http://localhost/', | ||
'http://localhost:8080/index.php', | ||
'http://192.168.1.3/', | ||
] | ||
|
||
for (const url of urls) { | ||
it(`URL_PATTERN regex matches URL ${url}`, () => { | ||
expect(new RegExp(URL_PATTERN).exec(url)).toBeTruthy() | ||
}) | ||
it(`URL_PATTERN_AUTOLINK regex matches URL ${url}`, () => { | ||
expect(new RegExp(URL_PATTERN_AUTOLINK).exec(url)).toBeTruthy() | ||
}) | ||
} | ||
}) |