Focus input on cherrypick dialog open
Bug: Issue 7407
Change-Id: Ic87053e63a3a3004cebae8fb5d1a4e76d0f07295
(cherry picked from commit f927042808)
This commit is contained in:
committed by
David Pursehouse
parent
be12867423
commit
19f695e6df
@@ -69,6 +69,10 @@
|
||||
this.fire('cancel', null, {bubbles: false});
|
||||
},
|
||||
|
||||
resetFocus() {
|
||||
this.$.branchInput.focus();
|
||||
},
|
||||
|
||||
_getProjectBranchesSuggestions(input) {
|
||||
if (input.startsWith('refs/heads/')) {
|
||||
input = input.substring('refs/heads/'.length);
|
||||
|
||||
@@ -34,8 +34,10 @@ limitations under the License.
|
||||
<script>
|
||||
suite('gr-confirm-cherrypick-dialog tests', () => {
|
||||
let element;
|
||||
let sandbox;
|
||||
|
||||
setup(() => {
|
||||
sandbox = sinon.sandbox.create();
|
||||
stub('gr-rest-api-interface', {
|
||||
getProjectBranches(input) {
|
||||
if (input.startsWith('test')) {
|
||||
@@ -55,6 +57,8 @@ limitations under the License.
|
||||
element.project = 'test-project';
|
||||
});
|
||||
|
||||
teardown(() => { sandbox.restore(); });
|
||||
|
||||
test('with merged change', () => {
|
||||
element.changeStatus = 'MERGED';
|
||||
element.commitMessage = 'message\n';
|
||||
@@ -93,6 +97,12 @@ limitations under the License.
|
||||
});
|
||||
});
|
||||
|
||||
test('resetFocus', () => {
|
||||
const focusStub = sandbox.stub(element.$.branchInput, 'focus');
|
||||
element.resetFocus();
|
||||
assert.isTrue(focusStub.called);
|
||||
});
|
||||
|
||||
test('_getProjectBranchesSuggestions non-empty', done => {
|
||||
element._getProjectBranchesSuggestions('test-branch').then(branches => {
|
||||
assert.equal(branches.length, 1);
|
||||
|
||||
Reference in New Issue
Block a user