mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1698] Task Info Drawer should be localizable (#2495)
* Card component should provide the localization * Fix unit test
This commit is contained in:
committed by
Denys Vuika
parent
0bdd66e158
commit
d5cd38b7ee
@@ -80,7 +80,7 @@ describe('TaskHeaderComponent', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('No assignee');
|
||||
expect(valueEl.nativeElement.innerText).toBe('TASK_PROPERTIES.ASSIGNEE_DEFAULT');
|
||||
});
|
||||
|
||||
it('should display created-by', () => {
|
||||
@@ -90,14 +90,6 @@ describe('TaskHeaderComponent', () => {
|
||||
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
|
||||
});
|
||||
|
||||
it('should display placeholder if no created-by', () => {
|
||||
component.taskDetails.assignee = null;
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-created-by"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('No assignee');
|
||||
});
|
||||
|
||||
it('should set editable to false if the task has already completed', () => {
|
||||
component.taskDetails.endDate = new Date('05/05/2002');
|
||||
component.ngOnChanges({});
|
||||
@@ -180,7 +172,7 @@ describe('TaskHeaderComponent', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('No date');
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('TASK_PROPERTIES.DUE_DATE_DEFAULT');
|
||||
});
|
||||
|
||||
it('should display form name', () => {
|
||||
@@ -196,7 +188,7 @@ describe('TaskHeaderComponent', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toEqual('None');
|
||||
expect(valueEl.nativeElement.innerText.trim()).toEqual('TASK_PROPERTIES.PARENT_NAME_DEFAULT');
|
||||
});
|
||||
|
||||
it('should display the Parent name value', () => {
|
||||
@@ -212,7 +204,7 @@ describe('TaskHeaderComponent', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('No form');
|
||||
expect(valueEl.nativeElement.innerText).toBe('TASK_PROPERTIES.FORM_NAME_DEFAULT');
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -57,23 +57,93 @@ export class TaskHeaderComponent implements OnChanges {
|
||||
if (this.taskDetails) {
|
||||
const parentInfoMap = this.getParentInfo();
|
||||
this.properties = [
|
||||
new CardViewTextItemModel({ label: 'Assignee', value: this.taskDetails.getFullName(), key: 'assignee', default: 'No assignee', clickable: !this.isCompleted() } ),
|
||||
new CardViewTextItemModel({ label: 'Status', value: this.getTaskStatus(), key: 'status' }),
|
||||
new CardViewDateItemModel({ label: 'Due Date', value: this.taskDetails.dueDate, key: 'dueDate', default: 'No date', editable: true }),
|
||||
new CardViewTextItemModel({ label: 'Category', value: this.taskDetails.category, key: 'category', default: 'No category' }),
|
||||
new CardViewMapItemModel({ label: 'Parent name', value: parentInfoMap, key: 'parentName', default: 'None', clickable: true }),
|
||||
new CardViewTextItemModel({ label: 'Created By', value: this.taskDetails.getFullName(), key: 'created-by', default: 'No assignee' }),
|
||||
new CardViewDateItemModel({ label: 'Created', value: this.taskDetails.created, key: 'created' }),
|
||||
new CardViewTextItemModel({ label: 'Id', value: this.taskDetails.id, key: 'id' }),
|
||||
new CardViewTextItemModel({
|
||||
label: 'Description',
|
||||
value: this.taskDetails.description,
|
||||
key: 'description',
|
||||
default: 'No description',
|
||||
multiline: true,
|
||||
editable: true
|
||||
}),
|
||||
new CardViewTextItemModel({ label: 'Form name', value: this.formName, key: 'formName', default: 'No form' })
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.ASSIGNEE',
|
||||
value: this.taskDetails.getFullName(),
|
||||
key: 'assignee',
|
||||
default: 'TASK_PROPERTIES.ASSIGNEE_DEFAULT',
|
||||
clickable: !this.isCompleted()
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.STATUS',
|
||||
value: this.getTaskStatus(),
|
||||
key: 'status'
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.PRIORITY',
|
||||
value: this.taskDetails.priority,
|
||||
key: 'priority'
|
||||
}
|
||||
),
|
||||
new CardViewDateItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.DUE_DATE',
|
||||
value: this.taskDetails.dueDate,
|
||||
key: 'dueDate',
|
||||
default: 'TASK_PROPERTIES.DUE_DATE_DEFAULT',
|
||||
editable: true
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.CATEGORY',
|
||||
value: this.taskDetails.category,
|
||||
key: 'category',
|
||||
default: 'TASK_PROPERTIES.CATEGORY_DEFAULT'
|
||||
}
|
||||
),
|
||||
new CardViewMapItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.PARENT_NAME',
|
||||
value: parentInfoMap, key: 'parentName',
|
||||
default: 'TASK_PROPERTIES.PARENT_NAME_DEFAULT',
|
||||
clickable: true
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.CREATED_BY',
|
||||
value: this.taskDetails.getFullName(),
|
||||
key: 'created-by'
|
||||
}
|
||||
),
|
||||
new CardViewDateItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.CREATED',
|
||||
value: this.taskDetails.created,
|
||||
key: 'created'
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.ID',
|
||||
value: this.taskDetails.id,
|
||||
key: 'id'
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.DESCRIPTION',
|
||||
value: this.taskDetails.description,
|
||||
key: 'description',
|
||||
default: 'TASK_PROPERTIES.DESCRIPTION_DEFAULT',
|
||||
multiline: true,
|
||||
editable: true
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
{
|
||||
label: 'TASK_PROPERTIES.FORM_NAME',
|
||||
value: this.formName,
|
||||
key: 'formName',
|
||||
default: 'TASK_PROPERTIES.FORM_NAME_DEFAULT'
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,25 @@
|
||||
"NONE": "No task lists found"
|
||||
}
|
||||
},
|
||||
"TASK_PROPERTIES": {
|
||||
"ASSIGNEE": "Assignee",
|
||||
"ASSIGNEE_DEFAULT": "No assignee",
|
||||
"PRIORITY": "Priority",
|
||||
"DUE_DATE": "Due Date",
|
||||
"DUE_DATE_DEFAULT": "No date",
|
||||
"STATUS": "Status",
|
||||
"CATEGORY": "Category",
|
||||
"CATEGORY_DEFAULT": "No category",
|
||||
"PARENT_NAME": "Parent name",
|
||||
"PARENT_NAME_DEFAULT": "No parent",
|
||||
"CREATED_BY": "Created By",
|
||||
"CREATED": "Created",
|
||||
"ID": "Id",
|
||||
"DESCRIPTION": "Description",
|
||||
"DESCRIPTION_DEFAULT": "No description",
|
||||
"FORM_NAME": "Form Name",
|
||||
"FORM_NAME_DEFAULT": "No form"
|
||||
},
|
||||
"TASK_DETAILS": {
|
||||
"LABELS": {
|
||||
"INFO_DRAWER_TITLE": "Activities",
|
||||
|
Reference in New Issue
Block a user