Add ctrl+enter shortcut in reply dialog
Bug: Issue 6335 Change-Id: I29a648560870d97c6dacaa11d35aa9e8a17ce779
This commit is contained in:
@@ -166,7 +166,8 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
keyBindings: {
|
keyBindings: {
|
||||||
esc: '_handleEscKey',
|
'esc': '_handleEscKey',
|
||||||
|
'ctrl+enter meta+enter': '_handleEnterKey',
|
||||||
},
|
},
|
||||||
|
|
||||||
observers: [
|
observers: [
|
||||||
@@ -229,6 +230,10 @@
|
|||||||
this.cancel();
|
this.cancel();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_handleEnterKey(e) {
|
||||||
|
this._submit();
|
||||||
|
},
|
||||||
|
|
||||||
_ccsChanged(splices) {
|
_ccsChanged(splices) {
|
||||||
if (splices && splices.indexSplices) {
|
if (splices && splices.indexSplices) {
|
||||||
this._processReviewerChange(splices.indexSplices, ReviewerTypes.CC);
|
this._processReviewerChange(splices.indexSplices, ReviewerTypes.CC);
|
||||||
@@ -622,6 +627,10 @@
|
|||||||
|
|
||||||
_sendTapHandler(e) {
|
_sendTapHandler(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
this._submit();
|
||||||
|
},
|
||||||
|
|
||||||
|
_submit() {
|
||||||
if (this._ccsEnabled && !this.$$('#ccs').submitEntryText()) {
|
if (this._ccsEnabled && !this.$$('#ccs').submitEntryText()) {
|
||||||
// Do not proceed with the send if there is an invalid email entry in
|
// Do not proceed with the send if there is an invalid email entry in
|
||||||
// the text field of the CC entry.
|
// the text field of the CC entry.
|
||||||
|
|||||||
@@ -701,6 +701,18 @@ limitations under the License.
|
|||||||
assert.isTrue(cancelHandler.called);
|
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', () => {
|
test('_computeMessagePlaceholder', () => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
element._computeMessagePlaceholder(false),
|
element._computeMessagePlaceholder(false),
|
||||||
|
|||||||
Reference in New Issue
Block a user