|
@@ -3,7 +3,7 @@
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-import env, { isEdge, isMac, isGecko, isSafari, isAndroid } from '../src/env';
|
|
|
|
|
|
|
+import env, { isEdge, isMac, isGecko, isSafari, isAndroid, isRegExpUnicodePropertySupported } from '../src/env';
|
|
|
|
|
|
|
|
function toLowerCase( str ) {
|
|
function toLowerCase( str ) {
|
|
|
return str.toLowerCase();
|
|
return str.toLowerCase();
|
|
@@ -44,6 +44,18 @@ describe( 'Env', () => {
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+ describe( 'features', () => {
|
|
|
|
|
+ it( 'is an object', () => {
|
|
|
|
|
+ expect( env.features ).to.be.an( 'object' );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ describe( 'isRegExpUnicodePropertySupported', () => {
|
|
|
|
|
+ it( 'is a boolean', () => {
|
|
|
|
|
+ expect( env.features.isRegExpUnicodePropertySupported ).to.be.a( 'boolean' );
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
describe( 'isMac()', () => {
|
|
describe( 'isMac()', () => {
|
|
|
it( 'returns true for macintosh UA strings', () => {
|
|
it( 'returns true for macintosh UA strings', () => {
|
|
|
expect( isMac( 'macintosh' ) ).to.be.true;
|
|
expect( isMac( 'macintosh' ) ).to.be.true;
|
|
@@ -169,4 +181,17 @@ describe( 'Env', () => {
|
|
|
} );
|
|
} );
|
|
|
/* eslint-enable max-len */
|
|
/* eslint-enable max-len */
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ describe( 'isRegExpUnicodePropertySupported()', () => {
|
|
|
|
|
+ it( 'should detect accessibility of unicode properties', () => {
|
|
|
|
|
+ // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534)
|
|
|
|
|
+ const testFn = () => ( new RegExp( '\\p{L}', 'u' ) ).test( 'ć' );
|
|
|
|
|
+
|
|
|
|
|
+ if ( isRegExpUnicodePropertySupported() ) {
|
|
|
|
|
+ expect( testFn() ).to.be.true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ expect( testFn ).to.throw();
|
|
|
|
|
+ }
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|