mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-11 09:14:02 -04:00
Close document if delete original chosen
This commit is contained in:
parent
47d697fb6b
commit
8bd17cf76b
@ -1161,6 +1161,8 @@ describe('DocumentDetailComponent', () => {
|
|||||||
it('should support pdf editor, handle error', () => {
|
it('should support pdf editor, handle error', () => {
|
||||||
let modal: NgbModalRef
|
let modal: NgbModalRef
|
||||||
modalService.activeInstances.subscribe((m) => (modal = m[0]))
|
modalService.activeInstances.subscribe((m) => (modal = m[0]))
|
||||||
|
const closeSpy = jest.spyOn(openDocumentsService, 'closeDocument')
|
||||||
|
const errorSpy = jest.spyOn(toastService, 'showError')
|
||||||
initNormally()
|
initNormally()
|
||||||
component.editPdf()
|
component.editPdf()
|
||||||
expect(modal).not.toBeUndefined()
|
expect(modal).not.toBeUndefined()
|
||||||
@ -1180,18 +1182,19 @@ describe('DocumentDetailComponent', () => {
|
|||||||
include_metadata: true,
|
include_metadata: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
req.flush(true)
|
req.error(new ErrorEvent('failed'))
|
||||||
|
expect(errorSpy).toHaveBeenCalled()
|
||||||
|
|
||||||
component.editPdf()
|
component.editPdf()
|
||||||
modal.componentInstance.documentID = doc.id
|
modal.componentInstance.documentID = doc.id
|
||||||
modal.componentInstance.pages = [{ page: 1, rotate: 0, splitAfter: true }]
|
modal.componentInstance.pages = [{ page: 1, rotate: 0, splitAfter: true }]
|
||||||
|
modal.componentInstance.deleteOriginal = true
|
||||||
modal.componentInstance.confirm()
|
modal.componentInstance.confirm()
|
||||||
const errorSpy = jest.spyOn(toastService, 'showError')
|
|
||||||
req = httpTestingController.expectOne(
|
req = httpTestingController.expectOne(
|
||||||
`${environment.apiBaseUrl}documents/bulk_edit/`
|
`${environment.apiBaseUrl}documents/bulk_edit/`
|
||||||
)
|
)
|
||||||
req.error(new ErrorEvent('failed'))
|
req.flush(true)
|
||||||
expect(errorSpy).toHaveBeenCalled()
|
expect(closeSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should support keyboard shortcuts', () => {
|
it('should support keyboard shortcuts', () => {
|
||||||
|
@ -1378,6 +1378,9 @@ export class DocumentDetailComponent
|
|||||||
$localize`PDF edit operation for "${this.document.title}" will begin in the background.`
|
$localize`PDF edit operation for "${this.document.title}" will begin in the background.`
|
||||||
)
|
)
|
||||||
modal.close()
|
modal.close()
|
||||||
|
if (modal.componentInstance.deleteOriginal) {
|
||||||
|
this.openDocumentService.closeDocument(this.document)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
if (modal) {
|
if (modal) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user