Skip to content

Commit

Permalink
Move logic for keystroke tests into separate helper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer authored and mlewand committed Oct 15, 2018
1 parent 548aac6 commit 56ab704
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions tests/plugins/link/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,29 +595,13 @@
} ),

// (#2478)
'test Ctrl+K keystroke': function() {
var bot = this.editorBots.noValidation,
editor = bot.editor;

bot.setData( '', function() {
editor.once( 'dialogShow', function( evt ) {
resume( function() {
var dialog = evt.data;

dialog.hide();
assert.areSame( 'link', dialog._.name );
} );
} );
'test Ctrl+K keystroke': assertKeystroke( 75 ),

editor.editable().fire( 'keydown', new CKEDITOR.dom.event( {
keyCode: 75,
ctrlKey: true
} ) );
wait();
} );
},
'test Ctrl+L keystroke': assertKeystroke( 76 )
} );

'test Ctrl+L keystroke': function() {
function assertKeystroke( key ) {
return function() {
var bot = this.editorBots.noValidation,
editor = bot.editor;

Expand All @@ -632,13 +616,13 @@
} );

editor.editable().fire( 'keydown', new CKEDITOR.dom.event( {
keyCode: 76,
keyCode: key,
ctrlKey: true
} ) );
wait();
} );
}
} );
};
}

function assertPhoneLinks( config ) {
return function() {
Expand Down

0 comments on commit 56ab704

Please sign in to comment.