minor fix e2e and styles

This commit is contained in:
Eugenio Romano
2019-03-29 02:09:07 +00:00
parent 24dfd33544
commit 2e151ed412
7 changed files with 84 additions and 36 deletions

View File

@@ -128,6 +128,7 @@ export class CardViewComponent implements OnInit {
value: 'click here',
key: 'click',
default: 'click here',
editable: this.isEditable,
clickable: true,
clickCallBack: () => {
this.respondToCardClick();

View File

@@ -43,7 +43,7 @@ export class TaskDetailsPage {
involvePeopleButton = element(by.css('div[class*="add-people"]'));
addPeopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
addInvolvedUserButton = element(by.css('button[id="add-people"] span'));
emailInvolvedUser = by.xpath('following-sibling::div[@class="adf-people-email ng-star-inserted"]');
emailInvolvedUser = by.xpath('following-sibling::div[@class="adf-people-email"]');
editActionInvolvedUser = by.xpath('following-sibling::div[@class="adf-people-edit-label ng-star-inserted"]');
involvedUserPic = by.xpath('ancestor::div/ancestor::div/preceding-sibling::div//div[@class="adf-people-search-people-pic ng-star-inserted"]');
taskDetailsInfoDrawer = element(by.tagName('adf-info-drawer'));
@@ -232,6 +232,7 @@ export class TaskDetailsPage {
addComment(comment) {
Util.waitUntilElementIsVisible(this.commentField);
this.commentField.sendKeys(comment);
Util.waitUntilElementIsVisible(this.addCommentButton);
this.addCommentButton.click();
return this;
}

View File

@@ -157,7 +157,24 @@ describe('CardViewTextItemComponent', () => {
expect(value.nativeElement.innerText.trim()).toBe('FAKE-DEFAULT-KEY');
});
it('should render the edit icon in case of clickable true and icon defined', () => {
it('should render the edit icon in case of clickable true and editable true', () => {
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
default: 'FAKE-DEFAULT-KEY',
clickable: true,
editable: true,
icon: 'FAKE-ICON'
});
fixture.detectChanges();
let value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-${component.property.icon}"]`));
expect(value).not.toBeNull();
expect(value.nativeElement.innerText.trim()).toBe('FAKE-ICON');
});
it('should not render the edit icon in case of clickable true and icon defined', () => {
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
@@ -169,7 +186,7 @@ describe('CardViewTextItemComponent', () => {
fixture.detectChanges();
let value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-${component.property.icon}"]`));
expect(value).not.toBeNull();
expect(value).toBeNull();
expect(value.nativeElement.innerText.trim()).toBe('FAKE-ICON');
});

View File

@@ -137,7 +137,12 @@ describe('Test PdfViewer component', () => {
],
providers: [
{ provide: TranslationService, useClass: TranslationMock },
{ provide: MatDialog, useValue: { open: () => {} } },
{
provide: MatDialog, useValue: {
open: () => {
}
}
},
RenderingQueueServices
]
});
@@ -334,6 +339,8 @@ describe('Test PdfViewer component', () => {
.subscribe(() => {
done();
});
fixtureUrlTestComponent.detectChanges();
});
afterEach(() => {
@@ -425,37 +432,52 @@ describe('Test PdfViewer component', () => {
});
}, 5000);
describe('Zoom', () => {
fdescribe('Zoom', () => {
it('should zoom in increment the scale value', () => {
let zoomInButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-in-button');
it('should zoom in increment the scale value', (done) => {
fixtureUrlTestComponent.detectChanges();
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
zoomInButton.click();
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
expect(zoomBefore < currentZoom).toBe(true);
}, 5000);
fixtureBlobTestComponent.whenStable().then(() => {
let zoomInButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-in-button');
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
zoomInButton.click();
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', () => {
let zoomOutButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-out-button');
fixtureUrlTestComponent.detectChanges();
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
zoomOutButton.click();
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
expect(zoomBefore > currentZoom).toBe(true);
}, 5000);
fixtureBlobTestComponent.whenStable().then(() => {
let zoomOutButton: any = elementUrlTestComponent.querySelector('#viewer-zoom-out-button');
it('should it-in button toggle page-fit and auto scale mode', () => {
let itPage: any = elementUrlTestComponent.querySelector('#viewer-scale-page-button');
let zoomBefore = componentUrlTestComponent.pdfViewerComponent.currentScale;
zoomOutButton.click();
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
let currentZoom = componentUrlTestComponent.pdfViewerComponent.currentScale;
expect(zoomBefore > currentZoom).toBe(true);
done();
});
});
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
itPage.click();
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('page-fit');
itPage.click();
expect(componentUrlTestComponent.pdfViewerComponent.currentScaleMode).toBe('auto');
}, 5000);
it('should fit-in button toggle page-fit and auto scale mode', () => {
fixtureUrlTestComponent.detectChanges();
fixtureBlobTestComponent.whenStable().then(() => {
let itPage: any = elementUrlTestComponent.querySelector('#viewer-scale-page-button');
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', () => {

View File

@@ -297,15 +297,17 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
* @param newScale - new scale page
*/
setScaleUpdatePages(newScale: number) {
if (!this.isSameScale(this.currentScale, newScale)) {
this.currentScale = newScale;
if (this.pdfViewer) {
if (!this.isSameScale(this.currentScale, newScale)) {
this.currentScale = newScale;
this.pdfViewer._pages.forEach(function (currentPage) {
currentPage.update(newScale);
});
this.pdfViewer._pages.forEach(function (currentPage) {
currentPage.update(newScale);
});
}
this.pdfViewer.update();
}
this.pdfViewer.update();
}
/**

View File

@@ -43,7 +43,6 @@
<div class="adf-people-user-info">
<div class="adf-people-full-name">{{ getDisplayUser(entry.row.obj.firstName, entry.row.obj.lastName, ' ') }}</div>
<div class="adf-people-email">{{ entry.row.obj.email }}</div>
<div class="adf-people-edit-label">can edit</div>
</div>
</ng-template>
</data-column>

View File

@@ -13,9 +13,11 @@
padding: 10px 0;
font-weight: bolder;
opacity: 0.54;
margin: 13px;
}
.adf-add-people {
margin: 13px;
float: right;
padding: 8px;
height: 26px;
@@ -60,6 +62,10 @@
display: none;
}
.adf-datatable-cell {
margin: 13px
}
.adf-datatable .adf-datatable-cell .adf-cell-container {
flex-direction: column;
align-items: left;