Skip to content

Commit 2fcd6c4

Browse files
shani-terminusbenjamincharity
authored andcommitted
fix(Select): space character works in autocomplete
ISSUES CLOSED: #1416
1 parent 1ab6e85 commit 2fcd6c4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

terminus-ui/select/src/select.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
[(ngModel)]="searchQuery"
8282
(ngModelChange)="querySubject.next(searchQuery)"
8383
(blur)="handleInputBlur($event)"
84+
(keydown)="$event.stopPropagation()"
8485
#input
8586
/>
8687

terminus-ui/select/src/select.component.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,19 +1095,20 @@ describe(`TsSelectComponent`, function() {
10951095
const fixture = createComponent(testComponents.AutocompleteAllowMultipleNoReopen);
10961096
fixture.detectChanges();
10971097

1098+
const element = getSelectElement(fixture);
10981099
const input = getAutocompleteInput(fixture);
10991100
typeInElement('fl', input);
11001101
fixture.detectChanges();
11011102

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

11041105
// move down to Florida and try to select it
1105-
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
1106-
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
1107-
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
1108-
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
1109-
dispatchKeyboardEvent(input, 'keydown', DOWN_ARROW);
1110-
dispatchKeyboardEvent(input, 'keydown', ENTER);
1106+
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
1107+
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
1108+
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
1109+
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
1110+
dispatchKeyboardEvent(element, 'keydown', DOWN_ARROW);
1111+
dispatchKeyboardEvent(element, 'keydown', ENTER);
11111112
fixture.detectChanges();
11121113

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

0 commit comments

Comments
 (0)