Skip to content
Permalink
Browse files

Updated emoji name.

  • Loading branch information
jacekbogdanski committed Nov 15, 2019
1 parent 42d9604 commit 93059e97da5a9aacd09fd897da808bb562cd94b6
Showing with 10 additions and 10 deletions.
  1. +4 −4 plugins/emoji/plugin.js
  2. +5 −5 tests/plugins/emoji/basic.js
  3. +1 −1 tests/plugins/emoji/dropdown.js
@@ -383,7 +383,7 @@
return acc + emojiTpl.output( {
symbol: htmlEncode( item.symbol ),
id: htmlEncode( item.id ),
name: item._name,
name: item.name,
group: htmlEncode( item.group ),
keywords: htmlEncode( ( item.keywords || [] ).join( ',' ) )
} );
@@ -600,7 +600,7 @@
editor._.emoji.autocomplete = new CKEDITOR.plugins.autocomplete( editor, {
textTestCallback: getTextTestCallback(),
dataCallback: dataCallback,
itemTemplate: '<li data-id="{id}" class="cke_emoji-suggestion_item"><span>{symbol}</span> {_name}</li>',
itemTemplate: '<li data-id="{id}" class="cke_emoji-suggestion_item"><span>{symbol}</span> {name}</li>',
outputTemplate: '{symbol}'
} );
}
@@ -661,8 +661,8 @@
} );

function addEncodedName( item ) {
if ( !item._name ) {
item._name = htmlEncode( item.id.replace( /::.*$/, ':' ).replace( /^:|:$/g, '' ).replace( /_/g, ' ' ) );
if ( !item.name ) {
item.name = htmlEncode( item.id.replace( /::.*$/, ':' ).replace( /^:|:$/g, '' ) );
}
return item;
}
@@ -104,11 +104,11 @@
return item.id === ':collision:';
} )[ 0 ];

assert.isUndefined( collision._name, 'Emoji name should be undefined.' );
assert.isUndefined( collision.name, 'Emoji name should be undefined.' );

editor.editable().fire( 'keyup', new CKEDITOR.dom.event( {} ) );

assert.areEqual( 'collision', collision._name, 'Emoji name should be cached.' );
assert.areEqual( 'collision', collision.name, 'Emoji name should be cached.' );
},

'test emoji objects are added to editor': function( editor ) {
@@ -225,19 +225,19 @@
} );

arrayAssert.itemsAreSame( expected, actual );
assert.areSame( '😻 smiling cat face with heart-eyes', autocomplete.view.element.getChild( 0 ).getText(), 'First element in view should start from "smiling".' );
assert.areSame( '😻 smiling_cat_face_with_heart-eyes' , autocomplete.view.element.getChild( 0 ).getText(), 'First element in view should start from "smiling".' );
} );
},

// (#2583)
'test emoji autocomplete panel displays name': function( editor, bot ) {
emojiTools.runAfterInstanceReady( editor, bot, function( editor, bot ) {
bot.setHtmlWithSelection( '<p>foo :collision:^</p>' );
bot.setHtmlWithSelection( '<p>foo 😻 :smiling_cat_face_with_heart-eyes:^</p>' );
editor.editable().fire( 'keyup', new CKEDITOR.dom.event( {} ) );

var element = CKEDITOR.document.findOne( '.cke_emoji-suggestion_item' );

assert.areEqual( element.getText(), '💥 collision' );
assert.areEqual( element.getText(), '😻 smiling_cat_face_with_heart-eyes' );
} );
}
};
@@ -40,7 +40,7 @@

bot.panel( 'EmojiPanel', function( panel ) {
panel.hide();
assert.areEqual( 'collision', collision._name, 'Emoji name should be cached.' );
assert.areEqual( 'collision', collision.name, 'Emoji name should be cached.' );
} );
},

0 comments on commit 93059e9

Please sign in to comment.
You can’t perform that action at this time.