mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-13 10:20:31 +01:00
Fixhancement: restore search highlighting and add for built-in viewer (#8885)
This commit is contained in:
@@ -158,4 +158,24 @@ describe('PreviewPopupComponent', () => {
|
||||
jest.advanceTimersByTime(1)
|
||||
expect(component.popover.isOpen()).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should dispatch find event on viewer loaded if searchQuery set', () => {
|
||||
documentService.searchQuery = 'test'
|
||||
settingsService.set(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER, false)
|
||||
component.popover.open()
|
||||
jest.advanceTimersByTime(1000)
|
||||
fixture.detectChanges()
|
||||
// normally setup by pdf-viewer
|
||||
jest.replaceProperty(component.pdfViewer, 'eventBus', {
|
||||
dispatch: jest.fn(),
|
||||
} as any)
|
||||
const dispatchSpy = jest.spyOn(component.pdfViewer.eventBus, 'dispatch')
|
||||
component.onPageRendered()
|
||||
expect(dispatchSpy).toHaveBeenCalledWith('find', {
|
||||
query: 'test',
|
||||
caseSensitive: false,
|
||||
highlightAll: true,
|
||||
phraseSearch: true,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user