[ADF-2388, ADF-2375] PDF Viewer - show buffer thumbnail on pagechange (#3011)

* disable thumbnails button until document is loaded

* show buffer thumbnail on page change

* correct value property

* correct test
This commit is contained in:
Cilibiu Bogdan
2018-03-06 09:00:52 +02:00
committed by Denys Vuika
parent 8f63af1fbd
commit 69ac38713f
8 changed files with 99 additions and 22 deletions

View File

@@ -437,4 +437,56 @@ describe('Test PdfViewer component', () => {
});
});
});
describe('Viewer events', () => {
beforeEach(() => {
component.urlFile = require('../assets/fake-test-file.pdf');
fixture.detectChanges();
});
it('should emit pagechange event', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
return fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
const args = {
pageNumber: 6,
source: {
container: component.documentContainer
}
};
component.pdfViewer.eventBus.dispatch('pagechange', args);
fixture.detectChanges();
expect(component.displayPage).toBe(6);
expect(component.page).toBe(6);
done();
});
});
});
it('should emit pagesloaded event', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
return fixture.whenStable().then(() => {
expect(component.isPanelDisabled).toBe(true);
const args = {
pagesCount: 10,
source: {
container: component.documentContainer
}
};
component.pdfViewer.eventBus.dispatch('pagesloaded', args);
fixture.detectChanges();
expect(component.isPanelDisabled).toBe(false);
done();
});
});
});
});
});