mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4338] Add locale to CardViewDateItemModel and improve logic of LocalizedDat… (#4845)
* Add locale to CardViewDateItemModel and improve logic of LocalizedDatePipe * Fix e2e tests * Fix e2e tests * Fix C305010 test
This commit is contained in:
committed by
Eugenio Romano
parent
e03290d26c
commit
334ebd1256
@@ -71,7 +71,7 @@ describe('ProcessInstanceHeaderComponent', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
|
||||
expect(valueEl.innerText).toBe('Nov 03 2016');
|
||||
expect(valueEl.innerText).toBe('Nov 3, 2016');
|
||||
});
|
||||
|
||||
it('should display placeholder if no due date', () => {
|
||||
@@ -103,7 +103,7 @@ describe('ProcessInstanceHeaderComponent', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-created"]');
|
||||
expect(valueEl.innerText).toBe('Nov 03 2016');
|
||||
expect(valueEl.innerText).toBe('Nov 3, 2016');
|
||||
});
|
||||
|
||||
it('should display started by', () => {
|
||||
|
@@ -31,9 +31,13 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
|
||||
processInstance: ProcessInstance;
|
||||
|
||||
properties: CardViewItem [];
|
||||
dateFormat: string;
|
||||
dateLocale: string;
|
||||
|
||||
constructor(private translationService: TranslationService,
|
||||
private appConfig: AppConfigService) {
|
||||
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat');
|
||||
this.dateLocale = this.appConfig.get('dateValues.defaultDateLocale');
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
@@ -60,7 +64,8 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
|
||||
{
|
||||
label: 'ADF_PROCESS_LIST.PROPERTIES.END_DATE',
|
||||
value: this.processInstance.ended,
|
||||
format: 'MMM DD YYYY',
|
||||
format: this.dateFormat,
|
||||
locale: this.dateLocale,
|
||||
key: 'ended',
|
||||
default: this.translationService.instant('ADF_PROCESS_LIST.PROPERTIES.END_DATE_DEFAULT')
|
||||
}),
|
||||
@@ -89,7 +94,8 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
|
||||
{
|
||||
label: 'ADF_PROCESS_LIST.PROPERTIES.CREATED',
|
||||
value: this.processInstance.started,
|
||||
format: 'MMM DD YYYY',
|
||||
format: this.dateFormat,
|
||||
locale: this.dateLocale,
|
||||
key: 'created'
|
||||
}),
|
||||
new CardViewTextItemModel(
|
||||
|
@@ -266,7 +266,7 @@ describe('TaskHeaderComponent', () => {
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('Nov 03 2016');
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('Nov 3, 2016');
|
||||
});
|
||||
}));
|
||||
|
||||
|
@@ -58,12 +58,16 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
|
||||
properties: CardViewItem [];
|
||||
inEdit: boolean = false;
|
||||
dateFormat: string;
|
||||
dateLocale: string;
|
||||
|
||||
constructor(private activitiTaskService: TaskListService,
|
||||
private bpmUserService: BpmUserService,
|
||||
private translationService: TranslationService,
|
||||
private logService: LogService,
|
||||
private appConfig: AppConfigService) {
|
||||
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat');
|
||||
this.dateLocale = this.appConfig.get('dateValues.defaultDateLocale');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -107,7 +111,9 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
value: this.taskDetails.dueDate,
|
||||
key: 'dueDate',
|
||||
default: this.translationService.instant('ADF_TASK_LIST.PROPERTIES.DUE_DATE_DEFAULT'),
|
||||
editable: true
|
||||
editable: true,
|
||||
format: this.dateFormat,
|
||||
locale: this.dateLocale
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
@@ -131,7 +137,9 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
{
|
||||
label: 'ADF_TASK_LIST.PROPERTIES.CREATED',
|
||||
value: this.taskDetails.created,
|
||||
key: 'created'
|
||||
key: 'created',
|
||||
format: this.dateFormat,
|
||||
locale: this.dateLocale
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
@@ -152,7 +160,9 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
{
|
||||
label: 'ADF_TASK_LIST.PROPERTIES.END_DATE',
|
||||
value: this.taskDetails.endDate,
|
||||
key: 'endDate'
|
||||
key: 'endDate',
|
||||
format: this.dateFormat,
|
||||
locale: this.dateLocale
|
||||
}
|
||||
),
|
||||
new CardViewTextItemModel(
|
||||
|
Reference in New Issue
Block a user