Auto-focus on confirm button in submit dialog
Change-Id: I5328e1d4ffc49019198ac8995ebff72b4684b192
This commit is contained in:
@@ -251,11 +251,12 @@ limitations under the License.
|
||||
});
|
||||
|
||||
test('submit change', done => {
|
||||
element.$.confirmSubmitDialog.$.confirm.focus = done;
|
||||
sandbox.stub(element.$.restAPI, 'getFromProjectLookup')
|
||||
.returns(Promise.resolve('test'));
|
||||
sandbox.stub(element, 'fetchChangeUpdates',
|
||||
() => { return Promise.resolve({isLatest: true}); });
|
||||
const showDialogStub = sandbox.stub(element, '_showActionDialog');
|
||||
sandbox.stub(element.$.overlay, 'open').returns(Promise.resolve());
|
||||
element.change = {
|
||||
revisions: {
|
||||
rev1: {_number: 1},
|
||||
@@ -264,16 +265,9 @@ limitations under the License.
|
||||
};
|
||||
element.latestPatchNum = '2';
|
||||
|
||||
flush(() => {
|
||||
const submitButton = element.$$('gr-button[data-action-key="submit"]');
|
||||
assert.ok(submitButton);
|
||||
MockInteractions.tap(submitButton);
|
||||
|
||||
assert.isTrue(showDialogStub.calledOnce);
|
||||
assert.equal(showDialogStub.lastCall.args[0],
|
||||
element.$.confirmSubmitDialog);
|
||||
done();
|
||||
});
|
||||
const submitButton = element.$$('gr-button[data-action-key="submit"]');
|
||||
assert.ok(submitButton);
|
||||
MockInteractions.tap(submitButton);
|
||||
});
|
||||
|
||||
test('_handleSubmitConfirm', () => {
|
||||
|
||||
@@ -60,7 +60,7 @@ limitations under the License.
|
||||
<main><slot name="main"></slot></main>
|
||||
<footer>
|
||||
<gr-button link on-tap="_handleCancelTap">[[cancelLabel]]</gr-button>
|
||||
<gr-button link primary on-tap="_handleConfirm" disabled="[[disabled]]">
|
||||
<gr-button id="confirm" link primary on-tap="_handleConfirm" disabled="[[disabled]]">
|
||||
[[confirmLabel]]
|
||||
</gr-button>
|
||||
</footer>
|
||||
|
||||
@@ -70,5 +70,9 @@
|
||||
_handleKeydown(e) {
|
||||
if (this.confirmOnEnter && e.keyCode === 13) { this._handleConfirm(e); }
|
||||
},
|
||||
|
||||
resetFocus() {
|
||||
this.$.confirm.focus();
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user