Skip to content

Commit

Permalink
ACS-6067 Added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksanderSklorz committed Nov 9, 2023
1 parent b593738 commit 27699c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/core/src/lib/viewer/components/pdf-viewer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
<ng-container *ngIf="thumbnailsTemplate">
<ng-container *ngTemplateOutlet="thumbnailsTemplate;context:pdfThumbnailsContext"></ng-container>
</ng-container>

<ng-container *ngIf="!thumbnailsTemplate && !isPanelDisabled">
<adf-pdf-thumbnails (close)="toggleThumbnails()" [pdfViewer]="pdfViewer"></adf-pdf-thumbnails>
</ng-container>
<adf-pdf-thumbnails *ngIf="!thumbnailsTemplate && !isPanelDisabled" (close)="toggleThumbnails()" [pdfViewer]="pdfViewer">
</adf-pdf-thumbnails>
</div>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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', () => {
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/lib/viewer/components/pdf-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 27699c0

Please sign in to comment.