Complete coverage
This commit is contained in:
@@ -276,6 +276,9 @@ describe('GlobalSearchComponent', () => {
|
||||
component.primaryAction(DataType.Document, object)
|
||||
expect(routerSpy).toHaveBeenCalledWith(['/documents', object.id])
|
||||
|
||||
component.primaryAction(DataType.SavedView, object)
|
||||
expect(routerSpy).toHaveBeenCalledWith(['/view', object.id])
|
||||
|
||||
component.primaryAction(DataType.Correspondent, object)
|
||||
expect(qfSpy).toHaveBeenCalledWith([
|
||||
{ rule_type: FILTER_HAS_CORRESPONDENT_ANY, value: object.id.toString() },
|
||||
|
||||
@@ -69,7 +69,7 @@ describe('HotKeyService', () => {
|
||||
expect(modalSpy).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should dismiss all modals on escape but not fire event', () => {
|
||||
it('should dismiss all modals on escape and not fire event', () => {
|
||||
const callback = jest.fn()
|
||||
service
|
||||
.addShortcut({ keys: 'escape', description: 'Escape' })
|
||||
@@ -84,4 +84,16 @@ describe('HotKeyService', () => {
|
||||
expect(dismissAllSpy).toHaveBeenCalled()
|
||||
expect(callback).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should not fire event on escape when open dropdowns ', () => {
|
||||
const callback = jest.fn()
|
||||
service
|
||||
.addShortcut({ keys: 'escape', description: 'Escape' })
|
||||
.subscribe(callback)
|
||||
const dropdown = document.createElement('div')
|
||||
dropdown.classList.add('dropdown-menu', 'show')
|
||||
document.body.appendChild(dropdown)
|
||||
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }))
|
||||
expect(callback).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user