Page Number doesn't change when user scroll the document #319

This commit is contained in:
Eugenio Romano
2016-07-04 21:13:05 +01:00
parent 3b0b679cca
commit 4641937a13
4 changed files with 100 additions and 6 deletions

View File

@@ -346,8 +346,7 @@ describe('PdfViewer', () => {
}));
});
describe('Rezize interaction', () => {
describe('Resize interaction', () => {
it('resize event should trigger setScaleUpdatePages', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(PdfViewerComponent)
@@ -370,4 +369,33 @@ describe('PdfViewer', () => {
}));
});
describe('scroll interaction', () => {
it('scroll page should return the current page', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(PdfViewerComponent)
.then((fixture) => {
let component = fixture.componentInstance;
spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
spyOn(component, 'initPDFViewer').and.callFake(() => {
component.pdfViewer = new PDFViewermock();
});
component.urlFile = 'fake-url-file';
component.ngOnChanges().then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
component.inputPage('4');
fixture.detectChanges();
expect(component.displayPage).toBe(4);
component.watchScroll({scrollTop: 10000});
expect(component.displayPage).toBe(4);
}).catch((error) => {
expect(error).toBeUndefined();
});
});
}));
});
});