mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-5857] modified unit tests
This commit is contained in:
@@ -123,13 +123,13 @@ describe('Form Renderer Component', () => {
|
|||||||
let displayTextElementContainer: HTMLInputElement = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
|
let displayTextElementContainer: HTMLInputElement = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
|
||||||
expectElementToBeHidden(displayTextElementContainer);
|
expectElementToBeHidden(displayTextElementContainer);
|
||||||
|
|
||||||
const formattedDate = format(new Date('2019-11-19'), 'd-M-yyyy');
|
const formattedDate = format(new Date('2019-11-19'), 'yyyy-M-d');
|
||||||
typeIntoDate(inputDateTestOne, { srcElement: { value: formattedDate } });
|
typeIntoDate(inputDateTestOne, { srcElement: { value: formattedDate } });
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
|
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
|
||||||
expectElementToBeVisible(displayTextElementContainer);
|
expectElementToBeVisible(displayTextElementContainer);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -142,13 +142,13 @@ describe('Form Renderer Component', () => {
|
|||||||
let displayTextElementContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
|
let displayTextElementContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
|
||||||
expectElementToBeVisible(displayTextElementContainer);
|
expectElementToBeVisible(displayTextElementContainer);
|
||||||
|
|
||||||
const formattedDate = format(new Date('2019-11-19'), 'd-M-yyyy');
|
const formattedDate = format(new Date('2019-11-19'), 'yyyy-M-d');
|
||||||
typeIntoDate(inputDateTestOne, { srcElement: { value: formattedDate } });
|
typeIntoDate(inputDateTestOne, { srcElement: { value: formattedDate } });
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
|
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
|
||||||
expectElementToBeHidden(displayTextElementContainer);
|
expectElementToBeHidden(displayTextElementContainer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1505,7 +1505,7 @@ export const formDateVisibility = {
|
|||||||
existingColspan: 1,
|
existingColspan: 1,
|
||||||
maxColspan: 2
|
maxColspan: 2
|
||||||
},
|
},
|
||||||
dateDisplayFormat: 'd-M-yyyy'
|
dateDisplayFormat: 'yyyy-M-d'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
2: [
|
2: [
|
||||||
@@ -1525,7 +1525,7 @@ export const formDateVisibility = {
|
|||||||
leftType: 'field',
|
leftType: 'field',
|
||||||
leftValue: 'Date0hwq20',
|
leftValue: 'Date0hwq20',
|
||||||
operator: '==',
|
operator: '==',
|
||||||
rightValue: '19-11-2019',
|
rightValue: '2019-11-19',
|
||||||
rightType: 'value',
|
rightType: 'value',
|
||||||
nextConditionOperator: '',
|
nextConditionOperator: '',
|
||||||
nextCondition: null
|
nextCondition: null
|
||||||
@@ -1562,7 +1562,7 @@ export const formDateVisibility = {
|
|||||||
leftType: 'field',
|
leftType: 'field',
|
||||||
leftValue: 'Date0hwq20',
|
leftValue: 'Date0hwq20',
|
||||||
operator: '!=',
|
operator: '!=',
|
||||||
rightValue: '19-11-2019',
|
rightValue: '2019-11-19',
|
||||||
rightType: 'value',
|
rightType: 'value',
|
||||||
nextConditionOperator: '',
|
nextConditionOperator: '',
|
||||||
nextCondition: null
|
nextCondition: null
|
||||||
|
|||||||
+4
-4
@@ -392,7 +392,7 @@ describe('DateWidgetComponent', () => {
|
|||||||
|
|
||||||
describe('check date validation by dynamic date ranges', () => {
|
describe('check date validation by dynamic date ranges', () => {
|
||||||
it('should minValue be equal to today date minus minDateRangeValue', async () => {
|
it('should minValue be equal to today date minus minDateRangeValue', async () => {
|
||||||
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('2022-07-22'));
|
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('2022-07-22'));
|
||||||
widget.field = new FormFieldModel(null, {
|
widget.field = new FormFieldModel(null, {
|
||||||
dynamicDateRangeSelection: true,
|
dynamicDateRangeSelection: true,
|
||||||
maxDateRangeValue: null,
|
maxDateRangeValue: null,
|
||||||
@@ -412,7 +412,7 @@ describe('DateWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should maxValue be equal to today date plus maxDateRangeValue', async () => {
|
it('should maxValue be equal to today date plus maxDateRangeValue', async () => {
|
||||||
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('2022-07-22'));
|
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('2022-07-22'));
|
||||||
widget.field = new FormFieldModel(null, {
|
widget.field = new FormFieldModel(null, {
|
||||||
dynamicDateRangeSelection: true,
|
dynamicDateRangeSelection: true,
|
||||||
maxDateRangeValue: 8,
|
maxDateRangeValue: 8,
|
||||||
@@ -432,7 +432,7 @@ describe('DateWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should maxValue and minValue be null if maxDateRangeValue and minDateRangeValue are null', async () => {
|
it('should maxValue and minValue be null if maxDateRangeValue and minDateRangeValue are null', async () => {
|
||||||
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('22-07-2022'));
|
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('22-07-2022'));
|
||||||
widget.field = new FormFieldModel(null, {
|
widget.field = new FormFieldModel(null, {
|
||||||
dynamicDateRangeSelection: true,
|
dynamicDateRangeSelection: true,
|
||||||
maxDateRangeValue: null,
|
maxDateRangeValue: null,
|
||||||
@@ -451,7 +451,7 @@ describe('DateWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should maxValue and minValue not be null if maxDateRangeVale and minDateRangeValue are not null', async () => {
|
it('should maxValue and minValue not be null if maxDateRangeVale and minDateRangeValue are not null', async () => {
|
||||||
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('2022-07-22'));
|
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('2022-07-22'));
|
||||||
widget.field = new FormFieldModel(null, {
|
widget.field = new FormFieldModel(null, {
|
||||||
dynamicDateRangeSelection: true,
|
dynamicDateRangeSelection: true,
|
||||||
maxDateRangeValue: 8,
|
maxDateRangeValue: 8,
|
||||||
|
|||||||
+2
-2
@@ -71,7 +71,7 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
|
|||||||
|
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
if (this.field.dynamicDateRangeSelection) {
|
if (this.field.dynamicDateRangeSelection) {
|
||||||
const today = this.getTodaysFormattedDate();
|
const today = this.getTodaysDate();
|
||||||
if (Number.isInteger(this.field.minDateRangeValue)) {
|
if (Number.isInteger(this.field.minDateRangeValue)) {
|
||||||
this.minDate = format(subDays(today, this.field.minDateRangeValue), DATE_FORMAT_CLOUD);
|
this.minDate = format(subDays(today, this.field.minDateRangeValue), DATE_FORMAT_CLOUD);
|
||||||
this.field.minValue = this.minDate;
|
this.field.minValue = this.minDate;
|
||||||
@@ -93,7 +93,7 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTodaysFormattedDate() {
|
getTodaysDate() {
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user