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()
}))
dropdownOpenChange(open: boolean): void {
if (open) {
setTimeout(() => {
- this.listFilterTextInput.nativeElement.focus()
+ this.listFilterTextInput?.nativeElement.focus()
}, 0)
if (this.editing) {
this.selectionModel.reset()
this.opened.next(this)
} else {
if (this.creating) {
- this.dropdown.open()
+ this.dropdown?.open()
this.creating = false
} else {
this.filterText = ''