Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Tests: Reused common code for RegExp punctuation groups feature detec…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
mlewand committed May 10, 2019
1 parent fcaeb31 commit 7d2f6c4
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions tests/mentionui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( () => {
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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;
}
} );

0 comments on commit 7d2f6c4

Please sign in to comment.