mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-35848 Fix dynamic viewer container scaling (#10932)
* AAE-35848 Fix dynamic viewer container scaling * AAE-35848 Add unit test * AAE-35848 Fix custom viewer test
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
|
||||
@if (urlFile || blobFile) {
|
||||
<div [hidden]="isLoading" class="adf-viewer-render-main">
|
||||
<div [style.visibility]="isLoading ? 'hidden' : 'visible'" class="adf-viewer-render-main">
|
||||
<div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container">
|
||||
<div class="adf-viewer-render-content-container" [ngSwitch]="viewerType">
|
||||
<ng-container *ngSwitchCase="'external'">
|
||||
|
@@ -278,6 +278,9 @@ describe('ViewerComponent', () => {
|
||||
fixtureCustom.detectChanges();
|
||||
await fixtureCustom.whenStable();
|
||||
|
||||
fixtureCustom.componentInstance.viewer1.markAsLoaded();
|
||||
fixtureCustom.detectChanges();
|
||||
|
||||
let customContent = getCustomViewerContent(fixtureCustom);
|
||||
expect(customComponent.extensionsSupportedByTemplates).toEqual(['json', 'test']);
|
||||
expect(customComponent.extensionTemplates.length).toBe(2);
|
||||
@@ -291,6 +294,9 @@ describe('ViewerComponent', () => {
|
||||
fixtureCustom.detectChanges();
|
||||
await fixtureCustom.whenStable();
|
||||
|
||||
fixtureCustom.componentInstance.viewer1.markAsLoaded();
|
||||
fixtureCustom.detectChanges();
|
||||
|
||||
customContent = getCustomViewerContent(fixtureCustom);
|
||||
expect(customComponent.extensionTemplates[0].isVisible).toBeFalse();
|
||||
expect(customComponent.extensionTemplates[1].isVisible).toBeTrue();
|
||||
@@ -410,6 +416,21 @@ describe('ViewerComponent', () => {
|
||||
expect(component.isSaving.emit).toHaveBeenCalledWith(true);
|
||||
});
|
||||
|
||||
it('should render invisible container during loading', async () => {
|
||||
component.urlFile = 'fake-url-file.png';
|
||||
component.viewerType = 'image';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges();
|
||||
component.isLoading = true;
|
||||
await fixture.whenStable();
|
||||
|
||||
const container: HTMLDivElement = testingUtils.getByCSS('.adf-viewer-render-main')?.nativeElement;
|
||||
expect(container).toBeDefined();
|
||||
expect(container.style.display).not.toBe('none');
|
||||
expect(container.clientWidth).toBe(0);
|
||||
expect(container.clientHeight).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
describe('Attribute', () => {
|
||||
it('should urlFile present not thrown any error ', () => {
|
||||
expect(() => {
|
||||
|
Reference in New Issue
Block a user