[ACS-6067] viewer thumbnails not refresh on file change (#9075)

* ACS-6067 Update thumbnails when file is changed

* ACS-6067 Added unit tests

* ACS-6067 Removed redundant line
This commit is contained in:
AleksanderSklorz
2023-11-14 12:44:48 +01:00
committed by GitHub
parent 15fdbc7e29
commit 6988c1f458
3 changed files with 12 additions and 4 deletions

View File

@@ -16,10 +16,8 @@
<ng-container *ngIf="thumbnailsTemplate">
<ng-container *ngTemplateOutlet="thumbnailsTemplate;context:pdfThumbnailsContext"></ng-container>
</ng-container>
<ng-container *ngIf="!thumbnailsTemplate">
<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>

View File

@@ -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', () => {

View File

@@ -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;