Skip to content

Commit 5a5a065

Browse files
maxokorokovpkozlowski-opensource
authored andcommitted
revert: fix(typeahead): replace 'click' with 'mousedown'
This reverts commit ab4c463 Closes ng-bootstrap#539
1 parent 862fbc5 commit 5a5a065

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/typeahead/typeahead-window.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('ngb-typeahead-window', () => {
114114

115115
expectResults(fixture.nativeElement, ['+bar', 'baz']);
116116

117-
links[1].triggerEventHandler('mousedown', {});
117+
links[1].triggerEventHandler('click', {});
118118
fixture.detectChanges();
119119
expect(fixture.componentInstance.selected).toBe('baz');
120120
});

src/typeahead/typeahead-window.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type ResultTplCtx = {
2020
<template ngFor [ngForOf]="results" let-result let-idx="index">
2121
<button class="dropdown-item" [class.active]="idx === _activeIdx"
2222
(mouseenter)="markActive(idx)"
23-
(mousedown)="select(result)">
23+
(click)="select(result)">
2424
<template [ngTemplateOutlet]="resultTemplate || rt"
2525
[ngOutletContext]="{result: result, term: term, formatter: formatter}"></template>
2626
</button>

src/typeahead/typeahead.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe('ngb-typeahead', () => {
201201
});
202202
})));
203203

204-
it('should select the result on mousedown, close window and fill the input',
204+
it('should select the result on click, close window and fill the input',
205205
async(inject([TestComponentBuilder], (tcb) => {
206206
const html = `<input type="text" [(ngModel)]="model" [ngbTypeahead]="find"/>`;
207207

@@ -214,7 +214,7 @@ describe('ngb-typeahead', () => {
214214
fixture.detectChanges();
215215
expectWindowResults(compiled, ['+one', 'one more']);
216216

217-
getWindowLinks(fixture.debugElement)[0].triggerEventHandler('mousedown', {});
217+
getWindowLinks(fixture.debugElement)[0].triggerEventHandler('click', {});
218218
fixture.detectChanges();
219219
expect(getWindow(compiled)).toBeNull();
220220
expectInputValue(compiled, 'one');
@@ -226,7 +226,7 @@ describe('ngb-typeahead', () => {
226226
expectWindowResults(compiled, ['+one', 'one more']);
227227
expectInputValue(compiled, 'o');
228228

229-
getWindowLinks(fixture.debugElement)[0].triggerEventHandler('mousedown', {});
229+
getWindowLinks(fixture.debugElement)[0].triggerEventHandler('click', {});
230230
fixture.detectChanges();
231231
expect(getWindow(compiled)).toBeNull();
232232
expectInputValue(compiled, 'one');

0 commit comments

Comments
 (0)