mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -16,10 +16,8 @@
|
|||||||
<ng-container *ngIf="thumbnailsTemplate">
|
<ng-container *ngIf="thumbnailsTemplate">
|
||||||
<ng-container *ngTemplateOutlet="thumbnailsTemplate;context:pdfThumbnailsContext"></ng-container>
|
<ng-container *ngTemplateOutlet="thumbnailsTemplate;context:pdfThumbnailsContext"></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<adf-pdf-thumbnails *ngIf="!thumbnailsTemplate && !isPanelDisabled" (close)="toggleThumbnails()" [pdfViewer]="pdfViewer">
|
||||||
<ng-container *ngIf="!thumbnailsTemplate">
|
</adf-pdf-thumbnails>
|
||||||
<adf-pdf-thumbnails (close)="toggleThumbnails()" [pdfViewer]="pdfViewer"></adf-pdf-thumbnails>
|
|
||||||
</ng-container>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@@ -27,6 +27,8 @@ import { take } from 'rxjs/operators';
|
|||||||
import { AppConfigService } from '../../app-config/app-config.service';
|
import { AppConfigService } from '../../app-config/app-config.service';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
import { CoreTestingModule } from '../../testing/core.testing.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { PdfThumbListComponent } from '@alfresco/adf-core';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
declare const pdfjsLib: any;
|
declare const pdfjsLib: any;
|
||||||
|
|
||||||
@@ -354,6 +356,13 @@ describe('Test PdfViewer component', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}, 55000);
|
}, 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', () => {
|
describe('Viewer events', () => {
|
||||||
|
@@ -205,6 +205,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
|
|||||||
this.loadingPercent = Math.round(level * 100);
|
this.loadingPercent = Math.round(level * 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isPanelDisabled = true;
|
||||||
this.loadingTask.promise
|
this.loadingTask.promise
|
||||||
.then((pdfDocument: PDFDocumentProxy) => {
|
.then((pdfDocument: PDFDocumentProxy) => {
|
||||||
this.totalPages = pdfDocument.numPages;
|
this.totalPages = pdfDocument.numPages;
|
||||||
|
Reference in New Issue
Block a user