From 61025e9f9b3c2b090d9d08ca5a7a11b9adb04102 Mon Sep 17 00:00:00 2001 From: Paladox none Date: Mon, 23 Oct 2017 11:03:40 +0000 Subject: [PATCH] PolyGerrit: Reduce the threshold in gr-watched-projects-editor Reducing the threshold to 1 allows for more aggressive autocomplete results, and also supports project names with less than three characters. Bug: Issue 7520 Change-Id: I7a97be7312806e5ba12bbc6e022ffa05741a2fe7 (cherry picked from commit cd63eb511af53374425ae55672a2155fadb50d65) --- .../gr-watched-projects-editor.html | 2 +- .../gr-watched-projects-editor_test.html | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.html b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.html index 68b2c23daa..cf5e0b187f 100644 --- a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.html +++ b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.html @@ -96,7 +96,7 @@ limitations under the License. diff --git a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.html b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.html index a93beb1f67..fbc6217519 100644 --- a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.html +++ b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.html @@ -58,7 +58,7 @@ limitations under the License. stub('gr-rest-api-interface', { getSuggestedProjects(input) { - if (input.startsWith('the')) { + if (input.startsWith('th')) { return Promise.resolve({'the project': { id: 'the project', state: 'ACTIVE', @@ -122,6 +122,14 @@ limitations under the License. }); }); + test('_getProjectSuggestions non-empty with two letter project', done => { + element._getProjectSuggestions('th').then(projects => { + assert.equal(projects.length, 1); + assert.equal(projects[0].name, 'the project'); + done(); + }); + }); + test('_canAddProject', () => { assert.isFalse(element._canAddProject(null, null)); assert.isFalse(element._canAddProject({}, null));