[ADF-2326] Process List - Provide a way to support custom html template and static columns at same time. (#2975)

* [ADF-2326] Process List - Provide a way to support custom html template and static columns at same time.

* Fixed support custom html template and static columns at same time

* Updated process list documentation with recent changes.

* * Added testcases for recent changes .
This commit is contained in:
siva kumar
2018-02-22 15:03:45 +05:30
committed by Eugenio Romano
parent 9bbdf4331e
commit 9c5be3eb27
4 changed files with 181 additions and 26 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { SimpleChange } from '@angular/core';
import { Component, SimpleChange, ViewChild } from '@angular/core';
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { MatProgressSpinnerModule } from '@angular/material';
import { Observable } from 'rxjs/Observable';
@@ -135,7 +135,7 @@ describe('ProcessInstanceListComponent', () => {
});
it('should fetch custom schemaColumn when the input presetColumn is defined', () => {
component.presetColumn = 'fakeCutomColumns';
component.presetColumn = 'fakeCutomSchema';
component.ngAfterContentInit();
fixture.detectChanges();
expect(component.data.getColumns()).toBeDefined();
@@ -483,3 +483,60 @@ describe('ProcessInstanceListComponent', () => {
});
});
});
@Component({
template: `
<adf-process-instance-list #processlistComponentInstance>
<data-columns>
<data-column key="name" title="ADF_PROCESS_LIST.PROPERTIES.NAME" class="full-width name-column"></data-column>
<data-column key="created" title="ADF_PROCESS_LIST.PROPERTIES.END_DATE" class="hidden"></data-column>
<data-column key="startedBy" title="ADF_PROCESS_LIST.PROPERTIES.CREATED" class="desktop-only dw-dt-col-3 ellipsis-cell">
<ng-template let-entry="$implicit">
<div>{{getFullName(entry.row.obj.startedBy)}}</div>
</ng-template>
</data-column>
</data-columns>
</adf-process-instance-list>`
})
class CustomProcessListComponent {
@ViewChild(ProcessInstanceListComponent)
processList: ProcessInstanceListComponent;
}
describe('CustomProcessListComponent', () => {
let fixture: ComponentFixture<CustomProcessListComponent>;
let component: CustomProcessListComponent;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
ProcessInstanceListComponent,
CustomProcessListComponent
],
providers: [
ProcessService
],
imports: []
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CustomProcessListComponent);
fixture.detectChanges();
component = fixture.componentInstance;
});
it('should create instance of CustomProcessListComponent', () => {
expect(component instanceof CustomProcessListComponent).toBe(true, 'should create CustomProcessListComponent');
});
it('should fetch custom schemaColumn from html', () => {
fixture.detectChanges();
expect(component.processList.data.getColumns()).toBeDefined();
expect(component.processList.data.getColumns()[1].title).toEqual('ADF_PROCESS_LIST.PROPERTIES.END_DATE');
expect(component.processList.data.getColumns()[2].title).toEqual('ADF_PROCESS_LIST.PROPERTIES.CREATED');
expect(component.processList.data.getColumns().length).toEqual(3);
});
});