Skip to content

Commit

Permalink
Added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
engineering-this authored and Comandeer committed Jul 9, 2018
1 parent f755ef5 commit 179dab1
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions tests/plugins/emoji/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
// Fallback in case where ajax couldn't load before tests.
var data = JSON.stringify( [
{ id: ':bug:', symbol: 'πŸ›' },
{ id: ':dagger:', symbol: 'πŸ—‘' }
{ id: ':dagger:', symbol: 'πŸ—‘' },
{ id: ':OK_hand:', symbol: 'πŸ‘Œ' }
] );

stub = sinon.stub( CKEDITOR.ajax, 'load', function( url, callback ) {
Expand Down Expand Up @@ -121,8 +122,29 @@
autocomplete.close();

} );
}
},

// (#2167)
'test emoji suggestion box is case insensitive': function( editor, bot ) {
emojiTools.runAfterInstanceReady( editor, bot, function( editor, bot ) {
var autocomplete = editor._.emoji.autocomplete,
queries = [ ':OK_HAND', ':ok_hand', ':OK_hand', ':ok_HAND', ':Ok_hanD', 'oK_HANd' ];

CKEDITOR.tools.array.forEach( queries, function( query, index ) {
setTimeout( function() {
resume();
bot.setHtmlWithSelection( '<p>foo' + query + '^</p>' );
editor.editable().fire( 'keyup', new CKEDITOR.dom.event( {} ) );

objectAssert.areEqual( { id: ':OK_hand:', symbol: 'πŸ‘Œ' }, autocomplete.model.data[ 0 ], 'Emoji result contains wrong result' );

emojiTools.clearAutocompleteModel( autocomplete );
autocomplete.close();
}, 50 * ( index + 1 ) );
wait();
} );
} );
}
};

tests = bender.tools.createTestsForEditors( CKEDITOR.tools.objectKeys( bender.editors ), tests );
Expand Down

0 comments on commit 179dab1

Please sign in to comment.