Skip to content

Commit

Permalink
fix(keyboard-bindings): add ie-specific key binding to remove selection
Browse files Browse the repository at this point in the history
Closes #904
  • Loading branch information
barmac committed Nov 15, 2018
1 parent 6bddeba commit d529a67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/features/keyboard/KeyboardBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ KeyboardBindings.prototype.registerBindings = function(keyboard, editorActions)

var event = context.keyEvent;

if (isKey('Delete', event)) {
if (isKey([ 'Delete', 'Del' ], event)) {
editorActions.trigger('removeSelection');

return true;
Expand Down
25 changes: 15 additions & 10 deletions test/spec/features/keyboard/RemoveSelectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import { createKeyEvent } from 'test/util/KeyEvents';

var spy = sinon.spy;

var KEYS = [ 'Delete' ];
var KEYS = [
'Delete',
'Del'
];


describe('features/keyboard - remove selection', function() {
Expand All @@ -38,19 +41,21 @@ describe('features/keyboard - remove selection', function() {

forEach(KEYS, function(key) {

it('should call remove selection', inject(function(keyboard, editorActions) {
it('should call remove selection when ' + key + ' is pressed',
inject(function(keyboard, editorActions) {

// given
var removeSelectionSpy = spy(editorActions, 'trigger');
// given
var removeSelectionSpy = spy(editorActions, 'trigger');

var event = createKeyEvent(key);
var event = createKeyEvent(key);

// when
keyboard._keyHandler(event);
// when
keyboard._keyHandler(event);

// then
expect(removeSelectionSpy.calledWith('removeSelection')).to.be.true;
}));
// then
expect(removeSelectionSpy.calledWith('removeSelection')).to.be.true;
})
);

});

Expand Down

0 comments on commit d529a67

Please sign in to comment.