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:
+4
-4
@@ -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,
|
||||
|
||||
+2
-2
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user