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', value: 'click here',
key: 'click', key: 'click',
default: 'click here', default: 'click here',
editable: this.isEditable,
clickable: true, clickable: true,
clickCallBack: () => { clickCallBack: () => {
this.respondToCardClick(); this.respondToCardClick();

View File

@@ -43,7 +43,7 @@ export class TaskDetailsPage {
involvePeopleButton = element(by.css('div[class*="add-people"]')); involvePeopleButton = element(by.css('div[class*="add-people"]'));
addPeopleField = element(by.css('input[data-automation-id="adf-people-search-input"]')); addPeopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
addInvolvedUserButton = element(by.css('button[id="add-people"] span')); 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"]'); 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"]'); 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')); taskDetailsInfoDrawer = element(by.tagName('adf-info-drawer'));
@@ -232,6 +232,7 @@ export class TaskDetailsPage {
addComment(comment) { addComment(comment) {
Util.waitUntilElementIsVisible(this.commentField); Util.waitUntilElementIsVisible(this.commentField);
this.commentField.sendKeys(comment); this.commentField.sendKeys(comment);
Util.waitUntilElementIsVisible(this.addCommentButton);
this.addCommentButton.click(); this.addCommentButton.click();
return this; return this;
} }

View File

@@ -157,7 +157,24 @@ describe('CardViewTextItemComponent', () => {
expect(value.nativeElement.innerText.trim()).toBe('FAKE-DEFAULT-KEY'); 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({ component.property = new CardViewTextItemModel({
label: 'Text label', label: 'Text label',
value: '', value: '',
@@ -169,7 +186,7 @@ describe('CardViewTextItemComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
let value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-${component.property.icon}"]`)); 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'); expect(value.nativeElement.innerText.trim()).toBe('FAKE-ICON');
}); });

View File

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

View File

@@ -297,15 +297,17 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
* @param newScale - new scale page * @param newScale - new scale page
*/ */
setScaleUpdatePages(newScale: number) { setScaleUpdatePages(newScale: number) {
if (!this.isSameScale(this.currentScale, newScale)) { if (this.pdfViewer) {
this.currentScale = newScale; if (!this.isSameScale(this.currentScale, newScale)) {
this.currentScale = newScale;
this.pdfViewer._pages.forEach(function (currentPage) { this.pdfViewer._pages.forEach(function (currentPage) {
currentPage.update(newScale); 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-user-info">
<div class="adf-people-full-name">{{ getDisplayUser(entry.row.obj.firstName, entry.row.obj.lastName, ' ') }}</div> <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-email">{{ entry.row.obj.email }}</div>
<div class="adf-people-edit-label">can edit</div>
</div> </div>
</ng-template> </ng-template>
</data-column> </data-column>

View File

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