Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix a random test error

shamoon8aa35540b57a
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts
index a285144f4..d1c37bc8b 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts
@@ -539,15 +539,10 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
fixture.nativeElement
.querySelector('button')
.dispatchEvent(new MouseEvent('click')) // open
- fixture.detectChanges()
tick(100)
component.filterText = 'FooBar'
- fixture.detectChanges()
- component.listFilterTextInput.nativeElement.dispatchEvent(
- new KeyboardEvent('keyup', { key: 'Enter' })
- )
+ component.listFilterEnter()
expect(component.selectionModel.getSelectedItems()).toEqual([])
- tick(300)
expect(createSpy).toHaveBeenCalled()
}))
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
index 4a3c70953..7830e3909 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
@@ -483,7 +483,7 @@ export class FilterableDropdownComponent implements OnDestroy, OnInit {
dropdownOpenChange(open: boolean): void {
if (open) {
setTimeout(() => {
- this.listFilterTextInput.nativeElement.focus()
+ this.listFilterTextInput?.nativeElement.focus()
}, 0)
if (this.editing) {
this.selectionModel.reset()
@@ -492,7 +492,7 @@ export class FilterableDropdownComponent implements OnDestroy, OnInit {
this.opened.next(this)
} else {
if (this.creating) {
- this.dropdown.open()
+ this.dropdown?.open()
this.creating = false
} else {
this.filterText = ''