mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2211] added configuration filter for task header properties (#2914)
* [ADF-2211] added configuration filter for task header properties * [ADF-2211] removed added configuration * [ADF-2211] updated schema.json with the new attribute * [ADF-2211] added schema check on build step of demo shell
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CardViewUpdateService } from '@alfresco/adf-core';
|
||||
import { CardViewUpdateService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { BpmUserService } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
@@ -39,6 +39,7 @@ describe('TaskHeaderComponent', () => {
|
||||
let component: TaskHeaderComponent;
|
||||
let fixture: ComponentFixture<TaskHeaderComponent>;
|
||||
let userBpmService: BpmUserService;
|
||||
let appConfigService: AppConfigService;
|
||||
|
||||
let fakeBpmAssignedUser = {
|
||||
id: 1001,
|
||||
@@ -65,7 +66,8 @@ describe('TaskHeaderComponent', () => {
|
||||
providers: [
|
||||
TaskListService,
|
||||
BpmUserService,
|
||||
CardViewUpdateService
|
||||
CardViewUpdateService,
|
||||
AppConfigService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
@@ -77,6 +79,7 @@ describe('TaskHeaderComponent', () => {
|
||||
userBpmService = TestBed.get(BpmUserService);
|
||||
spyOn(userBpmService, 'getCurrentUserInfo').and.returnValue(Observable.of(fakeBpmAssignedUser));
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
appConfigService = TestBed.get(AppConfigService);
|
||||
});
|
||||
|
||||
it('should render empty component if no task details provided', () => {
|
||||
@@ -279,4 +282,36 @@ describe('TaskHeaderComponent', () => {
|
||||
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
|
||||
});
|
||||
|
||||
describe('Config Filtering', () => {
|
||||
|
||||
it('should show only the properties from the configuration file', () => {
|
||||
spyOn(appConfigService, 'get').and.returnValue(['assignee', 'status']);
|
||||
component.taskDetails.processInstanceId = '1';
|
||||
component.taskDetails.processDefinitionName = 'Parent Name';
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
|
||||
expect(propertyList).toBeDefined();
|
||||
expect(propertyList).not.toBeNull();
|
||||
expect(propertyList.length).toBe(2);
|
||||
expect(propertyList[0].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.ASSIGNEE');
|
||||
expect(propertyList[1].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.STATUS');
|
||||
});
|
||||
|
||||
it('should show all the default properties if there is no configuration', () => {
|
||||
spyOn(appConfigService, 'get').and.returnValue(null);
|
||||
component.taskDetails.processInstanceId = '1';
|
||||
component.taskDetails.processDefinitionName = 'Parent Name';
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
|
||||
expect(propertyList).toBeDefined();
|
||||
expect(propertyList).not.toBeNull();
|
||||
expect(propertyList.length).toBe(component.properties.length);
|
||||
expect(propertyList[0].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.ASSIGNEE');
|
||||
expect(propertyList[1].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.STATUS');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user