Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to Value of dropdown changes automatically on item submission page #2432

Merged
merged 3 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<button class="dropdown-item disabled" *ngIf="optionsList && optionsList.length == 0">{{'form.no-results' | translate}}</button>
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList"
(click)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
(keydown.enter)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
title="{{ listEntry.display }}" role="option"
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
{{inputFormatter(listEntry)}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,15 @@ describe('Dynamic Dynamic Scrollable Dropdown component', () => {
let de: any = scrollableDropdownFixture.debugElement.query(By.css('input.form-control'));
let btnEl = de.nativeElement;

btnEl.click();
const mousedownEvent = new MouseEvent('mousedown');

btnEl.dispatchEvent(mousedownEvent);
scrollableDropdownFixture.detectChanges();

de = scrollableDropdownFixture.debugElement.queryAll(By.css('button.dropdown-item'));
btnEl = de[0].nativeElement;

btnEl.click();

btnEl.dispatchEvent(mousedownEvent);
scrollableDropdownFixture.detectChanges();

expect((scrollableDropdownComp.model as any).value).toEqual(selectedValue);
Expand Down
Loading