-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mobile] Use react-native-url-polyfill in globals (#27867)
* Use react-native-url-polyfill in globals * Ensure we are using react-native-url-polyfill in native url tests * Re-enable isURL fixture tests for mobile * Update exclusions for lack of unicode support * Remove native variant of is-url This platform fork is no longer necessary, since we are using the polyfill globally.
- Loading branch information
Showing
3 changed files
with
42 additions
and
20 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 was deleted.
Oops, something went wrong.
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,41 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import './index.js'; | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import 'react-native-url-polyfill/auto'; | ||
|
||
jest.mock( './fixtures/wpt-data.json', () => { | ||
const data = jest.requireActual( './fixtures/wpt-data.json' ); | ||
|
||
/** | ||
* Test items to exclude by input. Ideally this should be empty, but are | ||
* necessary by non-spec-conformance of the Native implementations. | ||
* Specifically, the React Native implementation uses an implementation of | ||
* WHATWG URL without full Unicode support. | ||
* | ||
* @type {string[]} | ||
*/ | ||
const URL_EXCEPTIONS = [ | ||
'https://�', | ||
'https://%EF%BF%BD', | ||
'http://a<b', | ||
'http://a>b', | ||
'http://a^b', | ||
'non-special://a<b', | ||
'non-special://a>b', | ||
'non-special://a^b', | ||
'ftp://example.com%80/', | ||
'ftp://example.com%A0/', | ||
'https://example.com%80/', | ||
'https://example.com%A0/', | ||
'file:///p', | ||
'file://%C2%AD/p', | ||
'file://xn--/p', | ||
]; | ||
|
||
return data.filter( ( { input } ) => ! URL_EXCEPTIONS.includes( input ) ); | ||
} ); |