Skip to content

Commit

Permalink
Merge pull request #2476 from DSpace/backport-2432-to-dspace-7_x
Browse files Browse the repository at this point in the history
[Port dspace-7_x] Fix to Value of dropdown changes automatically on item submission page
  • Loading branch information
alanorth authored Sep 5, 2023
2 parents cd350dd + eb38b58 commit 5f5d11c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 5f5d11c

Please sign in to comment.