Merge branch 'stable-3.3' into stable-3.4
* stable-3.3:
gr-confirm-move-dialog: Fix _getProjectBranchesSuggestions
Fix binding of DELETE REST calls from plugins
Change-Id: I75ee758e0facd8974bf8f4c8e33e1acb7f458be7
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts
index ce5b246..eb4053a 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts
@@ -55,7 +55,7 @@
project?: RepoName;
@property({type: Object})
- _query?: (_text?: string) => Promise<AutocompleteSuggestion[]>;
+ _query: (input: string) => Promise<AutocompleteSuggestion[]>;
get keyBindings() {
return {
@@ -67,7 +67,7 @@
constructor() {
super();
- this._query = () => this._getProjectBranchesSuggestions();
+ this._query = (text: string) => this._getProjectBranchesSuggestions(text);
}
_handleConfirmTap(e: Event) {
@@ -93,10 +93,9 @@
}
_getProjectBranchesSuggestions(
- input?: string
+ input: string
): Promise<AutocompleteSuggestion[]> {
if (!this.project) return Promise.reject(new Error('Missing project'));
- if (!input) return Promise.reject(new Error('Missing input'));
if (input.startsWith('refs/heads/')) {
input = input.substring('refs/heads/'.length);
}
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js
index db00f6b..36a2ad3 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js
@@ -64,5 +64,12 @@
done();
});
});
+
+ test('_getProjectBranchesSuggestions input empty string', done => {
+ element._getProjectBranchesSuggestions('').then(branches => {
+ assert.equal(branches.length, 0);
+ done();
+ });
+ });
});