@@ -8,7 +8,7 @@ import { getFormattedDate } from "./helpers";
8
8
9
9
describe ( "Components / Datepicker" , ( ) => {
10
10
it ( "should display today's date by default" , ( ) => {
11
- const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) ) ;
11
+ const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) , 'dd-MMM-yyy' ) ;
12
12
13
13
render ( < Datepicker /> ) ;
14
14
@@ -28,7 +28,7 @@ describe("Components / Datepicker", () => {
28
28
} ) ;
29
29
30
30
it ( "should reset to today's date when Clear button is clicked" , async ( ) => {
31
- const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) ) ;
31
+ const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) , 'dd-MMM-yyy' ) ;
32
32
const todaysDayOfMonth = new Date ( ) . getDate ( ) ;
33
33
const anotherDay = todaysDayOfMonth === 1 ? 2 : 1 ;
34
34
@@ -43,7 +43,7 @@ describe("Components / Datepicker", () => {
43
43
} ) ;
44
44
45
45
it ( "should use today's date when Today button is clicked" , async ( ) => {
46
- const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) ) ;
46
+ const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) , 'dd-MMM-yyy' ) ;
47
47
const todaysDayOfMonth = new Date ( ) . getDate ( ) ;
48
48
const anotherDay = todaysDayOfMonth === 1 ? 2 : 1 ;
49
49
@@ -90,7 +90,7 @@ describe("Components / Datepicker", () => {
90
90
} ) ;
91
91
92
92
it ( "should clear the value when ref.current.clear is called" , async ( ) => {
93
- const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) ) ;
93
+ const todaysDateInDefaultLanguage = getFormattedDate ( "en" , new Date ( ) , 'dd-MMM-yyyy' ) ;
94
94
const todaysDayOfMonth = new Date ( ) . getDate ( ) ;
95
95
const anotherDay = todaysDayOfMonth === 1 ? 2 : 1 ;
96
96
@@ -105,4 +105,12 @@ describe("Components / Datepicker", () => {
105
105
106
106
expect ( screen . getByDisplayValue ( todaysDateInDefaultLanguage ) ) . toBeInTheDocument ( ) ;
107
107
} ) ;
108
+
109
+ it ( "should display today's date in dd-MMM-yyyy format" , ( ) => {
110
+ const todaysDateInDefaultLanguage = getFormattedDate ( 'en-US' , new Date ( ) , 'dd-MMM-yyyy' ) ;
111
+
112
+ render ( < Datepicker inputFormat = "dd-MMM-yyyy" /> ) ;
113
+
114
+ expect ( screen . getByDisplayValue ( todaysDateInDefaultLanguage ) ) . toBeInTheDocument ( ) ;
115
+ } ) ;
108
116
} ) ;
0 commit comments