From 7d2f6c4768880297cbabd24eb15db630f0283ce7 Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Fri, 10 May 2019 16:25:44 +0200 Subject: [PATCH] Tests: Reused common code for RegExp punctuation groups feature detection. --- tests/mentionui.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tests/mentionui.js b/tests/mentionui.js index 9769856..d81f8b2 100644 --- a/tests/mentionui.js +++ b/tests/mentionui.js @@ -277,8 +277,6 @@ describe( 'MentionUI', () => { } ); describe( 'typing integration', () => { - const supportsES2018Escapes = checkES2018RegExpSupport(); - it( 'should show panel for matched marker after typing minimum characters', () => { return createClassicTestEditor( { feeds: [ Object.assign( { minimumCharacters: 2 }, staticConfig.feeds[ 0 ] ) ] } ) .then( () => { @@ -557,7 +555,7 @@ describe( 'MentionUI', () => { // Excerpt of opening parenthesis type characters that tests ES2018 Unicode property escapes on supported environment. for ( const character of [ '〈', '„', '﹛', '⦅', '{' ] ) { - testOpeningPunctuationCharacter( character, !supportsES2018Escapes ); + testOpeningPunctuationCharacter( character, !featureDetection.isPunctuationGroupSupported ); } it( 'should not show panel for marker in the middle of other word', () => { @@ -1725,16 +1723,4 @@ describe( 'MentionUI', () => { expect( mentionForCommand[ key ] ).to.equal( item[ key ] ); } } - - function checkES2018RegExpSupport() { - let supportsES2018Escapes = false; - - try { - supportsES2018Escapes = new RegExp( '\\p{Ps}', 'u' ).test( '〈' ); - } catch ( error ) { - // It's Ok we skip test on this browser. - } - - return supportsES2018Escapes; - } } );