Complete coverage
This commit is contained in:
parent
314e34c3b7
commit
3eaaa56241
@ -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()
|
||||
})
|
||||
})
|
||||
|
@ -1225,3 +1225,15 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
||||
self.assertEqual(results["mail_rules"][0]["id"], mail_rule1.id)
|
||||
self.assertEqual(results["custom_fields"][0]["id"], custom_field1.id)
|
||||
self.assertEqual(results["workflows"][0]["id"], workflow1.id)
|
||||
|
||||
def test_global_search_bad_request(self):
|
||||
"""
|
||||
WHEN:
|
||||
- Global search query is made without or with query < 3 characters
|
||||
THEN:
|
||||
- Error is returned
|
||||
"""
|
||||
response = self.client.get("/api/search/")
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
response = self.client.get("/api/search/?query=no")
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
Loading…
x
Reference in New Issue
Block a user