From 27699c07b9353de87c39a6911f0aba19ba50cd37 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 8 Nov 2023 10:37:47 +0100 Subject: [PATCH] ACS-6067 Added unit tests --- .../src/lib/viewer/components/pdf-viewer.component.html | 6 ++---- .../lib/viewer/components/pdf-viewer.component.spec.ts | 9 +++++++++ .../src/lib/viewer/components/pdf-viewer.component.ts | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.html b/lib/core/src/lib/viewer/components/pdf-viewer.component.html index 41a478e77db..9844cf51734 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.html +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.html @@ -16,10 +16,8 @@ - - - - + + diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts index a3361d08373..e33a9e0f22f 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts @@ -27,6 +27,8 @@ import { take } from 'rxjs/operators'; import { AppConfigService } from '../../app-config/app-config.service'; import { CoreTestingModule } from '../../testing/core.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { PdfThumbListComponent } from '@alfresco/adf-core'; +import { By } from '@angular/platform-browser'; declare const pdfjsLib: any; @@ -354,6 +356,13 @@ describe('Test PdfViewer component', () => { done(); }); }, 55000); + + it('should not render PdfThumbListComponent during initialization of new pdfViewer', () => { + componentUrlTestComponent.pdfViewerComponent.toggleThumbnails(); + componentUrlTestComponent.urlFile = 'file.pdf'; + fixtureUrlTestComponent.detectChanges(); + expect(fixtureUrlTestComponent.debugElement.query(By.directive(PdfThumbListComponent))).toBeNull(); + }); }); describe('Viewer events', () => { diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts index 91816fe5575..08f535fd25b 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts @@ -205,6 +205,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { this.loadingPercent = Math.round(level * 100); }; + this.isPanelDisabled = true; this.loadingTask.promise .then((pdfDocument: PDFDocumentProxy) => { this.totalPages = pdfDocument.numPages;