mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
fix lint pdf test
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||||
import { EventMock } from '../../mock/event.mock';
|
import { EventMock } from '../../mock/event.mock';
|
||||||
import { RenderingQueueServices } from '../services/rendering-queue.services';
|
import { RenderingQueueServices } from '../services/rendering-queue.services';
|
||||||
import { PdfViewerComponent } from './pdfViewer.component';
|
import { PdfViewerComponent } from './pdfViewer.component';
|
||||||
@@ -117,7 +117,7 @@ class BlobTestComponent {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Test PdfViewer component', () => {
|
fdescribe('Test PdfViewer component', () => {
|
||||||
|
|
||||||
let component: PdfViewerComponent;
|
let component: PdfViewerComponent;
|
||||||
let fixture: ComponentFixture<PdfViewerComponent>;
|
let fixture: ComponentFixture<PdfViewerComponent>;
|
||||||
@@ -137,12 +137,7 @@ describe('Test PdfViewer component', () => {
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
{ provide: TranslationService, useClass: TranslationMock },
|
||||||
{
|
{ provide: MatDialog, useValue: { open: () => {} } },
|
||||||
provide: MatDialog, useValue: {
|
|
||||||
open: () => {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RenderingQueueServices
|
RenderingQueueServices
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -206,14 +201,16 @@ describe('Test PdfViewer component', () => {
|
|||||||
document.body.removeChild(elementUrlTestComponent);
|
document.body.removeChild(elementUrlTestComponent);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should Canvas be present', (done) => {
|
it('should Canvas be present', fakeAsync(() => {
|
||||||
fixtureUrlTestComponent.detectChanges();
|
fixtureUrlTestComponent.detectChanges();
|
||||||
|
|
||||||
|
tick(250);
|
||||||
|
|
||||||
fixtureUrlTestComponent.whenStable().then(() => {
|
fixtureUrlTestComponent.whenStable().then(() => {
|
||||||
expect(elementUrlTestComponent.querySelector('.adf-pdfViewer')).not.toBeNull();
|
expect(elementUrlTestComponent.querySelector('.adf-pdfViewer')).not.toBeNull();
|
||||||
expect(elementUrlTestComponent.querySelector('.adf-viewer-pdf-viewer')).not.toBeNull();
|
expect(elementUrlTestComponent.querySelector('.adf-viewer-pdf-viewer')).not.toBeNull();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
}, 5000);
|
}));
|
||||||
|
|
||||||
it('should Next an Previous Buttons be present', (done) => {
|
it('should Next an Previous Buttons be present', (done) => {
|
||||||
fixtureUrlTestComponent.detectChanges();
|
fixtureUrlTestComponent.detectChanges();
|
||||||
@@ -339,8 +336,6 @@ describe('Test PdfViewer component', () => {
|
|||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
fixtureUrlTestComponent.detectChanges();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -432,52 +427,37 @@ describe('Test PdfViewer component', () => {
|
|||||||
});
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
fdescribe('Zoom', () => {
|
describe('Zoom', () => {
|
||||||
|
|
||||||
it('should zoom in increment the scale value', (done) => {
|
it('should zoom in increment the scale value', () => {
|
||||||
fixtureUrlTestComponent.detectChanges();
|
let zoomInButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-in-button');
|
||||||
|
|
||||||
fixtureBlobTestComponent.whenStable().then(() => {
|
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
||||||
|
zoomInButton.click();
|
||||||
let zoomInButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-in-button');
|
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
||||||
|
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
||||||
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
expect(zoomBefore < currentZoom).toBe(true);
|
||||||
zoomInButton.click();
|
}, 5000);
|
||||||
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
|
||||||
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
|
||||||
expect(zoomBefore < currentZoom).toBe(true);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should zoom out decrement the scale value', () => {
|
it('should zoom out decrement the scale value', () => {
|
||||||
fixtureUrlTestComponent.detectChanges();
|
let zoomOutButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-out-button');
|
||||||
|
|
||||||
fixtureBlobTestComponent.whenStable().then(() => {
|
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
||||||
let zoomOutButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-out-button');
|
zoomOutButton.click();
|
||||||
|
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
||||||
|
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
||||||
|
expect(zoomBefore > currentZoom).toBe(true);
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
it('should it-in button toggle page-fit and auto scale mode', () => {
|
||||||
zoomOutButton.click();
|
let itPage: any = elementUrlTestComponent.querySelector('#viewer-scale-page-button');
|
||||||
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
|
||||||
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
|
|
||||||
expect(zoomBefore > currentZoom).toBe(true);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should fit-in button toggle page-fit and auto scale mode', () => {
|
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
||||||
fixtureUrlTestComponent.detectChanges();
|
itPage.click();
|
||||||
|
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('page-fit');
|
||||||
fixtureBlobTestComponent.whenStable().then(() => {
|
itPage.click();
|
||||||
let itPage: any = elementUrlTestComponent.querySelector('#viewer-scale-page-button');
|
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
||||||
|
}, 5000);
|
||||||
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
|
||||||
itPage.click();
|
|
||||||
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('page-fit');
|
|
||||||
itPage.click();
|
|
||||||
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Resize interaction', () => {
|
describe('Resize interaction', () => {
|
||||||
|
Reference in New Issue
Block a user