-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1423 from ckeditor/t/1419
Fixed `alt + a` key combination for editor content selection on Windows
- Loading branch information
Showing
5 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* bender-tags: editor */ | ||
/* bender-ckeditor-plugins: widgetselection */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.editor = true; | ||
|
||
function testKeyCombination( editor, eventData, callCount ) { | ||
var addFillersStub = sinon.stub( CKEDITOR.plugins.widgetselection, 'addFillers' ); | ||
|
||
editor.document.fire( 'keydown', new CKEDITOR.dom.event( eventData ) ); | ||
|
||
// Test has to be async because widgetSelection.addFillers is called inside setTimeout. | ||
setTimeout( function() { | ||
resume( function() { | ||
addFillersStub.restore(); | ||
assert.areSame( callCount, addFillersStub.callCount, 'addFillers call count' ); | ||
} ); | ||
}, 50 ); | ||
|
||
wait(); | ||
} | ||
|
||
bender.test( { | ||
'test `ctrl + a` key combination': function() { | ||
var editor = this.editor; | ||
this.editorBot.setHtmlWithSelection( '<p contenteditable="false">Non-editable</p><p>This ^is text</p>' ); | ||
|
||
testKeyCombination( editor, { keyCode: 65, ctrlKey: true }, 1 ); | ||
}, | ||
|
||
'test ctrl + alt + a key combination': function() { | ||
var editor = this.editor; | ||
this.editorBot.setHtmlWithSelection( '<p contenteditable="false">Non-editable</p><p>This ^is text</p>' ); | ||
|
||
testKeyCombination( editor, { keyCode: 65, ctrlKey: true, altKey: true }, 0 ); | ||
} | ||
} ); | ||
|
||
} )(); |
11 changes: 11 additions & 0 deletions
11
tests/plugins/widgetselection/manual/specialcharacters.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div id="editor1"> | ||
<p contenteditable="false">NonEditable</p> | ||
<h1>Hello world!</h1> | ||
<p>I'm an instance of <a href="http://ckeditor.com">CKEditor</a>.</p> | ||
</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'editor1', { | ||
extraAllowedContent: 'p[contenteditable]' | ||
} ); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@bender-tags: 4.8.1, bug, 1419, widgetselection | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea,toolbar,link,format,sourcearea,widgetselection,elementspath | ||
|
||
---- | ||
|
||
1. Set system settings to use Polish keyboard layout. | ||
2. Focus editor instance. | ||
3. Press `AltGr (right alt) + a` (or `option + a` on Mac) to insert `ą` letter. | ||
|
||
## Expected | ||
`ą` letter has been inserted at the caret position. Editor content has not been selected. | ||
|
||
## Unexpected | ||
`ą` letter has not been inserted and/or editor content has been selected. |