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:
@@ -96,7 +96,7 @@ limitations under the License.
|
|||||||
<gr-autocomplete
|
<gr-autocomplete
|
||||||
id="newProject"
|
id="newProject"
|
||||||
query="[[_query]]"
|
query="[[_query]]"
|
||||||
threshold="3"
|
threshold="1"
|
||||||
placeholder="Project"></gr-autocomplete>
|
placeholder="Project"></gr-autocomplete>
|
||||||
</th>
|
</th>
|
||||||
<th colspan$="[[_getTypeCount()]]">
|
<th colspan$="[[_getTypeCount()]]">
|
||||||
|
@@ -58,7 +58,7 @@ limitations under the License.
|
|||||||
|
|
||||||
stub('gr-rest-api-interface', {
|
stub('gr-rest-api-interface', {
|
||||||
getSuggestedProjects(input) {
|
getSuggestedProjects(input) {
|
||||||
if (input.startsWith('the')) {
|
if (input.startsWith('th')) {
|
||||||
return Promise.resolve({'the project': {
|
return Promise.resolve({'the project': {
|
||||||
id: 'the project',
|
id: 'the project',
|
||||||
state: 'ACTIVE',
|
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', () => {
|
test('_canAddProject', () => {
|
||||||
assert.isFalse(element._canAddProject(null, null));
|
assert.isFalse(element._canAddProject(null, null));
|
||||||
assert.isFalse(element._canAddProject({}, null));
|
assert.isFalse(element._canAddProject({}, null));
|
||||||
|
Reference in New Issue
Block a user