[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, TestBed } from '@angular/core/testing';
import { MaterialModule } from '../../material.module';
import { AppConfigService } from '@alfresco/adf-core';
@@ -628,3 +628,60 @@ describe('TaskListComponent', () => {
});
});
});
@Component({
template: `
<adf-tasklist #taskList>
<data-columns>
<data-column key="name" title="ADF_TASK_LIST.PROPERTIES.NAME" class="full-width name-column"></data-column>
<data-column key="created" title="ADF_TASK_LIST.PROPERTIES.CREATED" class="hidden"></data-column>
<data-column key="startedBy" title="ADF_TASK_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-tasklist>`
})
class CustomTaskListComponent {
@ViewChild(TaskListComponent)
taskList: TaskListComponent;
}
describe('CustomTaskListComponent', () => {
let fixture: ComponentFixture<CustomTaskListComponent>;
let component: CustomTaskListComponent;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TaskListComponent,
CustomTaskListComponent
],
providers: [
TaskListService
],
imports: []
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CustomTaskListComponent);
fixture.detectChanges();
component = fixture.componentInstance;
});
it('should create instance of CustomTaskListComponent', () => {
expect(component instanceof CustomTaskListComponent).toBe(true, 'should create CustomTaskListComponent');
});
it('should fetch custom schemaColumn from html', () => {
fixture.detectChanges();
expect(component.taskList.data.getColumns()).toBeDefined();
expect(component.taskList.data.getColumns()[0].title).toEqual('ADF_TASK_LIST.PROPERTIES.NAME');
expect(component.taskList.data.getColumns()[2].title).toEqual('ADF_TASK_LIST.PROPERTIES.CREATED');
expect(component.taskList.data.getColumns().length).toEqual(3);
});
});