Templating: highlight first item when searching a variable dropdown (#20264)

This commit is contained in:
Torkel Ödegaard 2019-11-08 09:57:32 +01:00 committed by GitHub
parent 85c4311c9f
commit ba7049dd0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -279,7 +279,7 @@ export class ValueSelectDropdownCtrl {
}
updateUIBoundOptions($scope: IScope, options: any[]) {
this.highlightIndex = -1;
this.highlightIndex = 0;
this.search.options = options.slice(0, Math.min(options.length, 1000));
$scope.$apply();
}

View File

@ -253,8 +253,8 @@ describe('updateUIBoundOptions', () => {
ctrl.updateUIBoundOptions($scope, options);
});
it('then highlightIndex should be reset', () => {
expect(ctrl.highlightIndex).toEqual(-1);
it('then highlightIndex should be reset to first item', () => {
expect(ctrl.highlightIndex).toEqual(0);
});
it('then search.options should be same as options but capped to 1000', () => {