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 cd63eb511a)
This commit is contained in:
Paladox none
2017-10-23 11:03:40 +00:00
parent 0d7d81b794
commit 61025e9f9b
2 changed files with 10 additions and 2 deletions

View File

@@ -96,7 +96,7 @@ limitations under the License.
<gr-autocomplete
id="newProject"
query="[[_query]]"
threshold="3"
threshold="1"
placeholder="Project"></gr-autocomplete>
</th>
<th colspan$="[[_getTypeCount()]]">

View File

@@ -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));