Blur filter editor on escape when empty
This commit is contained in:
parent
8919482511
commit
63157583f3
@ -1814,6 +1814,11 @@ describe('FilterEditorComponent', () => {
|
|||||||
new KeyboardEvent('keyup', { key: 'Escape' })
|
new KeyboardEvent('keyup', { key: 'Escape' })
|
||||||
)
|
)
|
||||||
expect(component.textFilter).toEqual('')
|
expect(component.textFilter).toEqual('')
|
||||||
|
const blurSpy = jest.spyOn(component.textFilterInput.nativeElement, 'blur')
|
||||||
|
component.textFilterInput.nativeElement.dispatchEvent(
|
||||||
|
new KeyboardEvent('keyup', { key: 'Escape' })
|
||||||
|
)
|
||||||
|
expect(blurSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should adjust text filter targets if more like search', () => {
|
it('should adjust text filter targets if more like search', () => {
|
||||||
|
@ -975,8 +975,12 @@ export class FilterEditorComponent
|
|||||||
if (filterString.length) {
|
if (filterString.length) {
|
||||||
this.updateTextFilter(filterString)
|
this.updateTextFilter(filterString)
|
||||||
}
|
}
|
||||||
} else if (event.key == 'Escape') {
|
} else if (event.key === 'Escape') {
|
||||||
this.resetTextField()
|
if (this._textFilter?.length) {
|
||||||
|
this.resetTextField()
|
||||||
|
} else {
|
||||||
|
this.textFilterInput.nativeElement.blur()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user