Merge "Add ctrl+s as keyboard shortcut to save comment draft"
This commit is contained in:
@@ -198,8 +198,15 @@
|
||||
},
|
||||
|
||||
_handleTextareaKeydown: function(e) {
|
||||
if (e.keyCode == 27) { // 'esc'
|
||||
switch (e.keyCode) {
|
||||
case 27: // 'esc'
|
||||
this._handleCancel(e);
|
||||
break;
|
||||
case 83: // 's'
|
||||
if (e.ctrlKey) {
|
||||
this._handleSave(e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -211,6 +211,18 @@ limitations under the License.
|
||||
MockInteractions.pressAndReleaseKeyOn(element.$.editTextarea, 27); // esc
|
||||
});
|
||||
|
||||
test('ctrl+s saves comment', function(done) {
|
||||
var stub = sinon.stub(element, 'save', function() {
|
||||
assert.isTrue(stub.called);
|
||||
stub.restore();
|
||||
done();
|
||||
});
|
||||
element._messageText = 'is that the horse from horsing around??';
|
||||
MockInteractions.pressAndReleaseKeyOn(
|
||||
element.$.editTextarea.textarea,
|
||||
83, 'ctrl'); // 'ctrl + s'
|
||||
});
|
||||
|
||||
test('draft saving/editing', function(done) {
|
||||
var fireStub = sinon.stub(element, 'fire');
|
||||
|
||||
|
Reference in New Issue
Block a user