[ACS-5857] modified unit tests

This commit is contained in:
SheenaMalhotra182
2023-09-20 15:47:19 +05:30
parent 4b9a625e26
commit d94be47ec3
4 changed files with 13 additions and 13 deletions
@@ -123,13 +123,13 @@ describe('Form Renderer Component', () => {
let displayTextElementContainer: HTMLInputElement = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
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 } });
fixture.detectChanges();
await fixture.whenStable();
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
expectElementToBeVisible(displayTextElementContainer);
});
@@ -142,13 +142,13 @@ describe('Form Renderer Component', () => {
let displayTextElementContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
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 } });
fixture.detectChanges();
await fixture.whenStable();
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0pqd1u-container');
displayTextElementContainer = fixture.nativeElement.querySelector('#field-Text0uyqd3-container');
expectElementToBeHidden(displayTextElementContainer);
});
@@ -1505,7 +1505,7 @@ export const formDateVisibility = {
existingColspan: 1,
maxColspan: 2
},
dateDisplayFormat: 'd-M-yyyy'
dateDisplayFormat: 'yyyy-M-d'
}
],
2: [
@@ -1525,7 +1525,7 @@ export const formDateVisibility = {
leftType: 'field',
leftValue: 'Date0hwq20',
operator: '==',
rightValue: '19-11-2019',
rightValue: '2019-11-19',
rightType: 'value',
nextConditionOperator: '',
nextCondition: null
@@ -1562,7 +1562,7 @@ export const formDateVisibility = {
leftType: 'field',
leftValue: 'Date0hwq20',
operator: '!=',
rightValue: '19-11-2019',
rightValue: '2019-11-19',
rightType: 'value',
nextConditionOperator: '',
nextCondition: null
@@ -392,7 +392,7 @@ describe('DateWidgetComponent', () => {
describe('check date validation by dynamic date ranges', () => {
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, {
dynamicDateRangeSelection: true,
maxDateRangeValue: null,
@@ -412,7 +412,7 @@ describe('DateWidgetComponent', () => {
});
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, {
dynamicDateRangeSelection: true,
maxDateRangeValue: 8,
@@ -432,7 +432,7 @@ describe('DateWidgetComponent', () => {
});
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, {
dynamicDateRangeSelection: true,
maxDateRangeValue: null,
@@ -451,7 +451,7 @@ describe('DateWidgetComponent', () => {
});
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, {
dynamicDateRangeSelection: true,
maxDateRangeValue: 8,
@@ -71,7 +71,7 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
if (this.field) {
if (this.field.dynamicDateRangeSelection) {
const today = this.getTodaysFormattedDate();
const today = this.getTodaysDate();
if (Number.isInteger(this.field.minDateRangeValue)) {
this.minDate = format(subDays(today, this.field.minDateRangeValue), DATE_FORMAT_CLOUD);
this.field.minValue = this.minDate;
@@ -93,7 +93,7 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
}
}
getTodaysFormattedDate() {
getTodaysDate() {
return new Date();
}