Skip to content

Commit

Permalink
fix(Select): space character works in autocomplete
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #1416
  • Loading branch information
shani-terminus authored and benjamincharity committed Mar 28, 2019
1 parent 1ab6e85 commit 2fcd6c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions terminus-ui/select/src/select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
[(ngModel)]="searchQuery"
(ngModelChange)="querySubject.next(searchQuery)"
(blur)="handleInputBlur($event)"
(keydown)="$event.stopPropagation()"
#input
/>

Expand Down
13 changes: 7 additions & 6 deletions terminus-ui/select/src/select.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,19 +1095,20 @@ describe(`TsSelectComponent`, function() {
const fixture = createComponent(testComponents.AutocompleteAllowMultipleNoReopen);
fixture.detectChanges();

const element = getSelectElement(fixture);
const input = getAutocompleteInput(fixture);
typeInElement('fl', input);
fixture.detectChanges();

expect(input.value).toEqual('fl');

// move down to Florida and try to select it
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(input, 'keydown', ENTER);
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
dispatchKeyboardEvent(element, 'keydown', ENTER);
fixture.detectChanges();

expect(input.value).toEqual('');
Expand Down

0 comments on commit 2fcd6c4

Please sign in to comment.