|
|
@@ -445,10 +445,10 @@ describe( 'MentionUI', () => {
|
|
|
let regExpStub;
|
|
|
|
|
|
// Cache the original value to restore it after the tests.
|
|
|
- const originalPunctuationSupport = featureDetection.isPunctuationGroupSupported;
|
|
|
+ const originalGroupSupport = featureDetection.isUnicodeGroupSupported;
|
|
|
|
|
|
before( () => {
|
|
|
- featureDetection.isPunctuationGroupSupported = false;
|
|
|
+ featureDetection.isUnicodeGroupSupported = false;
|
|
|
} );
|
|
|
|
|
|
beforeEach( () => {
|
|
|
@@ -461,21 +461,21 @@ describe( 'MentionUI', () => {
|
|
|
} );
|
|
|
|
|
|
after( () => {
|
|
|
- featureDetection.isPunctuationGroupSupported = originalPunctuationSupport;
|
|
|
+ featureDetection.isUnicodeGroupSupported = originalGroupSupport;
|
|
|
} );
|
|
|
|
|
|
it( 'returns a simplified RegExp for browsers not supporting Unicode punctuation groups', () => {
|
|
|
- featureDetection.isPunctuationGroupSupported = false;
|
|
|
+ featureDetection.isUnicodeGroupSupported = false;
|
|
|
createRegExp( '@', 2 );
|
|
|
sinon.assert.calledOnce( regExpStub );
|
|
|
- sinon.assert.calledWithExactly( regExpStub, '(^|[ \\(\\[{"\'])([@])([_a-zA-Z0-9À-ž]{2,}?)$', 'u' );
|
|
|
+ sinon.assert.calledWithExactly( regExpStub, '(?:^|[ \\(\\[{"\'])([@])([_a-zA-ZÀ-ž0-9]{2,}?)$', 'u' );
|
|
|
} );
|
|
|
|
|
|
it( 'returns a ES2018 RegExp for browsers supporting Unicode punctuation groups', () => {
|
|
|
- featureDetection.isPunctuationGroupSupported = true;
|
|
|
+ featureDetection.isUnicodeGroupSupported = true;
|
|
|
createRegExp( '@', 2 );
|
|
|
sinon.assert.calledOnce( regExpStub );
|
|
|
- sinon.assert.calledWithExactly( regExpStub, '(^|[ \\p{Ps}\\p{Pi}"\'])([@])([_a-zA-Z0-9À-ž]{2,}?)$', 'u' );
|
|
|
+ sinon.assert.calledWithExactly( regExpStub, '(?:^|[ \\p{Ps}\\p{Pi}"\'])([@])([_\\p{L}\\p{N}]{2,}?)$', 'u' );
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
@@ -560,7 +560,7 @@ describe( 'MentionUI', () => {
|
|
|
// Belongs to Pi (Punctuation, Initial quote) group:
|
|
|
'«', '‹', '⸌', ' ⸂', '⸠'
|
|
|
] ) {
|
|
|
- testOpeningPunctuationCharacter( character, !featureDetection.isPunctuationGroupSupported );
|
|
|
+ testOpeningPunctuationCharacter( character, !featureDetection.isUnicodeGroupSupported );
|
|
|
}
|
|
|
|
|
|
it( 'should not show panel for marker in the middle of other word', () => {
|
|
|
@@ -792,6 +792,39 @@ describe( 'MentionUI', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
+ describe( 'unicode', () => {
|
|
|
+ beforeEach( () => {
|
|
|
+ return createClassicTestEditor( {
|
|
|
+ feeds: [
|
|
|
+ {
|
|
|
+ // Always return 5 items
|
|
|
+ feed: () => [ '@Barney', '@Lily', '@Marshall', '@Robin', '@Ted' ],
|
|
|
+ marker: '@'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should open panel for unicode character ב', function() {
|
|
|
+ if ( !featureDetection.isUnicodeGroupSupported ) {
|
|
|
+ this.skip();
|
|
|
+ }
|
|
|
+
|
|
|
+ setData( model, '<paragraph>foo []</paragraph>' );
|
|
|
+
|
|
|
+ model.change( writer => {
|
|
|
+ writer.insertText( '@ב', doc.selection.getFirstPosition() );
|
|
|
+ } );
|
|
|
+
|
|
|
+ return waitForDebounce()
|
|
|
+ .then( () => {
|
|
|
+ expect( panelView.isVisible, 'panel is visible' ).to.be.true;
|
|
|
+ expect( editor.model.markers.has( 'mention' ), 'marker is inserted' ).to.be.true;
|
|
|
+ expect( mentionsView.items ).to.have.length( 5 );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
describe( 'asynchronous list with custom trigger', () => {
|
|
|
beforeEach( () => {
|
|
|
const issuesNumbers = [ '#100', '#101', '#102', '#103' ];
|