Add ctrl+enter shortcut in reply dialog

Bug: Issue 6335
Change-Id: I29a648560870d97c6dacaa11d35aa9e8a17ce779
This commit is contained in:
Mike Frysinger
2017-07-25 18:24:32 -04:00
parent 2e76b3f4f8
commit 81b90bc4ef
2 changed files with 22 additions and 1 deletions

View File

@@ -166,7 +166,8 @@
],
keyBindings: {
esc: '_handleEscKey',
'esc': '_handleEscKey',
'ctrl+enter meta+enter': '_handleEnterKey',
},
observers: [
@@ -229,6 +230,10 @@
this.cancel();
},
_handleEnterKey(e) {
this._submit();
},
_ccsChanged(splices) {
if (splices && splices.indexSplices) {
this._processReviewerChange(splices.indexSplices, ReviewerTypes.CC);
@@ -622,6 +627,10 @@
_sendTapHandler(e) {
e.preventDefault();
this._submit();
},
_submit() {
if (this._ccsEnabled && !this.$$('#ccs').submitEntryText()) {
// Do not proceed with the send if there is an invalid email entry in
// the text field of the CC entry.

View File

@@ -701,6 +701,18 @@ limitations under the License.
assert.isTrue(cancelHandler.called);
});
test('should not send on enter key', () => {
element.addEventListener('send', () => assert.fail('wrongly called'));
MockInteractions.pressAndReleaseKeyOn(element, 13, null, 'enter');
flushAsynchronousOperations();
});
test('emit send on ctrl+enter key', done => {
element.addEventListener('send', () => done());
MockInteractions.pressAndReleaseKeyOn(element, 13, 'ctrl', 'enter');
flushAsynchronousOperations();
});
test('_computeMessagePlaceholder', () => {
assert.equal(
element._computeMessagePlaceholder(false),