mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-463] - change dueDate render component (#5200)
* change dueDate render component * fix tests * fix lint * rebase and add test * split code into 2 declarations
This commit is contained in:
committed by
Eugenio Romano
parent
f20b78a2c5
commit
b41514cad7
@@ -25,6 +25,7 @@ import { of, throwError } from 'rxjs';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import moment = require('moment');
|
||||
|
||||
describe('TaskHeaderCloudComponent', () => {
|
||||
let component: TaskHeaderCloudComponent;
|
||||
@@ -138,7 +139,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('Dec 18, 2018');
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe(moment(assignedTaskDetailsCloudMock.dueDate, 'x').format('MMM D, Y, H:mm'));
|
||||
});
|
||||
}));
|
||||
|
||||
|
@@ -25,7 +25,8 @@ import {
|
||||
TranslationService,
|
||||
AppConfigService,
|
||||
UpdateNotification,
|
||||
CardViewUpdateService
|
||||
CardViewUpdateService,
|
||||
CardViewDatetimeItemModel
|
||||
} from '@alfresco/adf-core';
|
||||
import { TaskDetailsCloudModel, TaskStatusEnum } from '../../start-task/models/task-details-cloud.model';
|
||||
import { Router } from '@angular/router';
|
||||
@@ -66,6 +67,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
inEdit: boolean = false;
|
||||
parentTaskName: string;
|
||||
dateFormat: string;
|
||||
dateTimeFormat: string;
|
||||
dateLocale: string;
|
||||
displayDateClearAction = false;
|
||||
|
||||
@@ -80,6 +82,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
) {
|
||||
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat');
|
||||
this.dateLocale = this.appConfig.get('dateValues.defaultDateLocale');
|
||||
this.dateTimeFormat = this.appConfig.get('dateValue.defaultDateTimeFormat');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -145,14 +148,14 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
validators: [new NumericFieldValidator()]
|
||||
}
|
||||
),
|
||||
new CardViewDateItemModel(
|
||||
new CardViewDatetimeItemModel(
|
||||
{
|
||||
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.DUE_DATE',
|
||||
value: this.taskDetails.dueDate,
|
||||
key: 'dueDate',
|
||||
default: this.translationService.instant('ADF_CLOUD_TASK_HEADER.PROPERTIES.DUE_DATE_DEFAULT'),
|
||||
editable: true,
|
||||
format: this.dateFormat,
|
||||
format: this.dateTimeFormat,
|
||||
locale: this.dateLocale
|
||||
}
|
||||
),
|
||||
|
@@ -26,7 +26,7 @@ export const assignedTaskDetailsCloudMock = new TaskDetailsCloudModel(
|
||||
'name': 'This is a new task ',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': 1545048055900,
|
||||
'dueDate': 1545091200000,
|
||||
'dueDate': Date.now(),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
|
Reference in New Issue
Block a user