From 2e151ed4121fe60e998f2ea2c4ded8900689638e Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 29 Mar 2019 02:09:07 +0000 Subject: [PATCH] minor fix e2e and styles --- .../card-view/card-view.component.ts | 1 + .../adf/process-services/taskDetailsPage.ts | 3 +- .../card-view-textitem.component.spec.ts | 21 +++++- .../components/pdfViewer.component.spec.ts | 72 ++++++++++++------- .../viewer/components/pdfViewer.component.ts | 16 +++-- .../components/people/people.component.html | 1 - .../components/people/people.component.scss | 6 ++ 7 files changed, 84 insertions(+), 36 deletions(-) diff --git a/demo-shell/src/app/components/card-view/card-view.component.ts b/demo-shell/src/app/components/card-view/card-view.component.ts index 2d1c927cf0..b9dfc16e95 100644 --- a/demo-shell/src/app/components/card-view/card-view.component.ts +++ b/demo-shell/src/app/components/card-view/card-view.component.ts @@ -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(); diff --git a/e2e/pages/adf/process-services/taskDetailsPage.ts b/e2e/pages/adf/process-services/taskDetailsPage.ts index 484c5c5e08..176433243e 100644 --- a/e2e/pages/adf/process-services/taskDetailsPage.ts +++ b/e2e/pages/adf/process-services/taskDetailsPage.ts @@ -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; } diff --git a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts index 726cb11a3b..aa160756ff 100644 --- a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts +++ b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts @@ -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'); }); diff --git a/lib/core/viewer/components/pdfViewer.component.spec.ts b/lib/core/viewer/components/pdfViewer.component.spec.ts index 58ef24d538..721135960f 100644 --- a/lib/core/viewer/components/pdfViewer.component.spec.ts +++ b/lib/core/viewer/components/pdfViewer.component.spec.ts @@ -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', () => { diff --git a/lib/core/viewer/components/pdfViewer.component.ts b/lib/core/viewer/components/pdfViewer.component.ts index 42fb582202..4300e5bfd7 100644 --- a/lib/core/viewer/components/pdfViewer.component.ts +++ b/lib/core/viewer/components/pdfViewer.component.ts @@ -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(); } /** diff --git a/lib/process-services/people/components/people/people.component.html b/lib/process-services/people/components/people/people.component.html index ac1f9a2dc9..d2a93e4eea 100644 --- a/lib/process-services/people/components/people/people.component.html +++ b/lib/process-services/people/components/people/people.component.html @@ -43,7 +43,6 @@
{{ getDisplayUser(entry.row.obj.firstName, entry.row.obj.lastName, ' ') }}
{{ entry.row.obj.email }}
-
can edit
diff --git a/lib/process-services/people/components/people/people.component.scss b/lib/process-services/people/components/people/people.component.scss index e8fd375cf9..bf31ab97b1 100644 --- a/lib/process-services/people/components/people/people.component.scss +++ b/lib/process-services/people/components/people/people.component.scss @@ -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;