relative pointing (#1879)

readme modify
start.sh and nom-build-all refactoring
change travis conf
update version of zone.js (fixes console error)
karma conf remove dist
add alias build
override tsconfig components build
This commit is contained in:
Eugenio Romano
2017-05-22 09:57:10 +01:00
committed by Eugenio Romano
parent d5f90a59f4
commit 075ee8a538
55 changed files with 815 additions and 258 deletions

View File

@@ -185,19 +185,25 @@ describe('Test ng2-alfresco-viewer PdfViewer component', () => {
it('Total number of pages should be loaded', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.totalPages).toEqual(6);
done();
fixture.whenStable().then(() => {
expect(component.totalPages).toEqual(6);
done();
});
});
}, 5000);
it('right arrow should move to the next page', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
EventMock.keyDown(39);
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
EventMock.keyDown(39);
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
});
});
}, 5000);
@@ -206,24 +212,30 @@ describe('Test ng2-alfresco-viewer PdfViewer component', () => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
nextPageButton.click();
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
nextPageButton.click();
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
});
});
});
it('left arrow should move to the previous page', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
EventMock.keyDown(39);
EventMock.keyDown(39);
EventMock.keyDown(37);
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
EventMock.keyDown(39);
EventMock.keyDown(39);
EventMock.keyDown(37);
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
});
});
});
@@ -233,35 +245,44 @@ describe('Test ng2-alfresco-viewer PdfViewer component', () => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
nextPageButton.click();
nextPageButton.click();
previousPageButton.click();
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
nextPageButton.click();
nextPageButton.click();
previousPageButton.click();
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
});
});
});
it('previous page should not move to the previous page if is page 1', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
component.previousPage();
fixture.detectChanges();
expect(component.displayPage).toBe(1);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
component.previousPage();
fixture.detectChanges();
expect(component.displayPage).toBe(1);
done();
});
});
});
it('Input page should move to the inserted page', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
component.inputPage('2');
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
component.inputPage('2');
fixture.detectChanges();
expect(component.displayPage).toBe(2);
done();
});
});
});
@@ -314,39 +335,50 @@ describe('Test ng2-alfresco-viewer PdfViewer component', () => {
});
describe('Resize interaction', () => {
beforeEach(() => {
component.urlFile = require('../assets/fake-test-file.pdf');
fixture.detectChanges();
component.inputPage('1');
});
it('resize event should trigger setScaleUpdatePages', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
spyOn(component, 'onResize');
EventMock.resizeMobileView();
expect(component.onResize).toHaveBeenCalled();
done();
fixture.whenStable().then(() => {
spyOn(component, 'onResize');
EventMock.resizeMobileView();
expect(component.onResize).toHaveBeenCalled();
done();
});
});
});
});
describe('scroll interaction', () => {
beforeEach(() => {
component.urlFile = require('../assets/fake-test-file.pdf');
fixture.detectChanges();
});
it('scroll page should return the current page', (done) => {
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(component.displayPage).toBe(1);
component.inputPage('2');
fixture.detectChanges();
expect(component.displayPage).toBe(2);
let documentContainer = element.querySelector('#viewer-pdf-container');
documentContainer.scrollTop = 100000;
component.watchScroll(documentContainer);
fixture.detectChanges();
expect(component.displayPage).toBe(6);
done();
fixture.whenStable().then(() => {
expect(component.displayPage).toBe(1);
component.inputPage('2');
fixture.detectChanges();
expect(component.displayPage).toBe(2);
let documentContainer = element.querySelector('#viewer-pdf-container');
documentContainer.scrollTop = 100000;
component.watchScroll(documentContainer);
fixture.detectChanges();
expect(component.displayPage).toBe(6);
done();
});
});
});
});