mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-26 01:12:43 -05:00
Fix: render images not converted to pdf, refactor doc detail rendering (#5475)
This commit is contained in:
@@ -996,6 +996,53 @@ describe('DocumentDetailComponent', () => {
|
||||
expect(closeSpy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should change preview element by render type', () => {
|
||||
component.metadata = { has_archive_version: true }
|
||||
initNormally()
|
||||
fixture.detectChanges()
|
||||
expect(component.contentRenderType).toEqual(component.ContentRenderType.PDF)
|
||||
expect(
|
||||
fixture.debugElement.query(By.css('pdf-viewer-container'))
|
||||
).not.toBeUndefined()
|
||||
|
||||
component.metadata = {
|
||||
has_archive_version: false,
|
||||
original_mime_type: 'text/plain',
|
||||
}
|
||||
fixture.detectChanges()
|
||||
expect(component.contentRenderType).toEqual(
|
||||
component.ContentRenderType.Text
|
||||
)
|
||||
expect(
|
||||
fixture.debugElement.query(By.css('div.preview-sticky'))
|
||||
).not.toBeUndefined()
|
||||
|
||||
component.metadata = {
|
||||
has_archive_version: false,
|
||||
original_mime_type: 'image/jpg',
|
||||
}
|
||||
fixture.detectChanges()
|
||||
expect(component.contentRenderType).toEqual(
|
||||
component.ContentRenderType.Image
|
||||
)
|
||||
expect(
|
||||
fixture.debugElement.query(By.css('.preview-sticky img'))
|
||||
).not.toBeUndefined()
|
||||
|
||||
component.metadata = {
|
||||
has_archive_version: false,
|
||||
original_mime_type:
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
}
|
||||
fixture.detectChanges()
|
||||
expect(component.contentRenderType).toEqual(
|
||||
component.ContentRenderType.Other
|
||||
)
|
||||
expect(
|
||||
fixture.debugElement.query(By.css('object.preview-sticky'))
|
||||
).not.toBeUndefined()
|
||||
})
|
||||
|
||||
function initNormally() {
|
||||
jest
|
||||
.spyOn(activatedRoute, 'paramMap', 'get')
|
||||
|
Reference in New Issue
Block a user