[ADF-1466] Ng2-activiti-tasklist module uses NO_ERRORS_SCHEMA schema, which hides underlying error (#2271)

* [ADF-1466] Ng2-activiti-tasklist module uses NO_ERRORS_SCHEMA schema, which hides underlying error

* Added directives for the custom tags

* Replaced empty list tags with new directives

* Removed CUSTOM_ELEMENTS_SCHEMA document-list, task-list and process-list

* Handled empty attachment list sceeenario in attachment list

* [ADF-1466] Ng2-activiti-tasklist module uses NO_ERRORS_SCHEMA schema, which hides underlying error

* Added tests for disabled and non empty attachments scenario
This commit is contained in:
Deepak Paul
2017-09-01 16:53:51 +05:30
committed by Mario Romano
parent c9b7ddff90
commit 287630d40f
18 changed files with 87 additions and 71 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModule } from '@angular/core';
import { ModuleWithProviders, NgModule } from '@angular/core';
import {
MdButtonModule,
MdCardModule,
@@ -148,8 +148,7 @@ export const ACTIVITI_PROCESSLIST_PROVIDERS: [any] = [
],
exports: [
...ACTIVITI_PROCESSLIST_DIRECTIVES
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
]
})
export class ActivitiProcessListModule {
static forRoot(): ModuleWithProviders {

View File

@@ -1,21 +1,14 @@
<adf-datatable [rows]="attachments" [actions]="true" [loading]="isLoading" (rowDblClick)="openContent($event)" (showRowActionsMenu)="onShowRowActionsMenu($event)"
(executeRowAction)="onExecuteRowAction($event)">
<adf-empty-list *ngIf="!isDisabled()">
<adf-empty-list-header>
<div> {{'PROCESS-ATTACHMENT.EMPTY.HEADER' | translate}} </div>
</adf-empty-list-header>
<adf-empty-list-body>
<adf-empty-list *ngIf="isEmpty()">
<div adf-empty-list-header class="adf-empty-list-header"> {{'PROCESS-ATTACHMENT.EMPTY.HEADER' | translate}} </div>
<div adf-empty-list-body *ngIf="!isDisabled()">
<div class="adf-empty-list-drag_drop">{{'PROCESS-ATTACHMENT.EMPTY.DRAG-AND-DROP.TITLE' | translate}}</div>
<div class="adf-empty-list__any-files-here-to-add"> {{'PROCESS-ATTACHMENT.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate}} </div>
</adf-empty-list-body>
<adf-empty-list-footer>
<div><img class="adf-empty-list__empty_doc_lib" [src]="emptyListImageUrl"></div>
</adf-empty-list-footer>
</adf-empty-list>
<adf-empty-list *ngIf="isDisabled()">
<adf-empty-list-header>
<div> {{'PROCESS-ATTACHMENT.EMPTY-LIST.HEADER' | translate}} </div>
</adf-empty-list-header>
</div>
<div adf-empty-list-footer *ngIf="!isDisabled()">
<img class="adf-empty-list__empty_doc_lib" [src]="emptyListImageUrl">
</div>
</adf-empty-list>
<data-columns>
<data-column key="icon" type="icon" srTitle="Thumbnail" [sortable]="false"></data-column>

View File

@@ -1,6 +1,5 @@
adf-datatable /deep/ .column-header {
adf-datatable /deep/ th span {
color: #232323;
font-size: 15px;
}
adf-datatable /deep/ .data-cell {
@@ -12,7 +11,7 @@ adf-datatable /deep/ .data-cell {
margin-right: calc((100% - 100px) / 2);
}
adf-empty-list-header /deep/ div {
.adf-empty-list-header {
height: 32px;
opacity: 0.26 !important;
font-family: Muli, Helvetica, Arial, sans-serif;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange } from '@angular/core';
import { SimpleChange } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MdProgressSpinnerModule } from '@angular/material';
import { By } from '@angular/platform-browser';
@@ -52,8 +52,7 @@ describe('ProcessAttachmentListComponent', () => {
providers: [
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
ActivitiContentService
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
]
}).compileComponents();
}));
@@ -213,7 +212,7 @@ describe('ProcessAttachmentListComponent', () => {
component.ngOnChanges({'processInstanceId': change});
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('adf-empty-list-header').innerText.trim()).toEqual('PROCESS-ATTACHMENT.EMPTY.HEADER');
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim()).toEqual('PROCESS-ATTACHMENT.EMPTY.HEADER');
});
}));
@@ -245,7 +244,19 @@ describe('ProcessAttachmentListComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('adf-empty-list-header').innerText.trim()).toEqual('PROCESS-ATTACHMENT.EMPTY-LIST.HEADER');
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim()).toEqual('PROCESS-ATTACHMENT.EMPTY.HEADER');
});
}));
it('should not show the empty list component when the attachments list is not empty for completed process', async(() => {
getProcessRelatedContentSpy.and.returnValue(Observable.of(mockAttachment));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'processInstanceId': change});
component.disabled = true;
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]')).toBeNull();
});
}));