@@ -122,26 +122,60 @@ describe('Utils and date utils formatting', () => {
122
122
expect ( years [ 1 ] . value ) . toEqual ( 2022 ) ;
123
123
} ) ;
124
124
125
- it ( 'Should get month values according to locale' , ( ) => {
125
+ it ( 'Should get long month values according to locale' , ( ) => {
126
126
const months = getMonths ( null , 'en' , 'long' ) ;
127
127
128
128
expect ( months ) . toHaveLength ( 12 ) ;
129
129
expect ( months [ 0 ] . text ) . toEqual ( 'January' ) ;
130
+ expect ( months [ 1 ] . text ) . toEqual ( 'February' ) ;
131
+ expect ( months [ 2 ] . text ) . toEqual ( 'March' ) ;
130
132
} ) ;
131
133
132
- it ( 'Should get month values according to formatLocale' , ( ) => {
134
+ it ( 'Should get short month values according to locale' , ( ) => {
135
+ const months = getMonths ( null , 'en' , 'short' ) ;
136
+
137
+ expect ( months ) . toHaveLength ( 12 ) ;
138
+ expect ( months [ 0 ] . text ) . toEqual ( 'Jan' ) ;
139
+ expect ( months [ 1 ] . text ) . toEqual ( 'Feb' ) ;
140
+ expect ( months [ 2 ] . text ) . toEqual ( 'Mar' ) ;
141
+ } ) ;
142
+
143
+ it ( 'Should get long month values according to formatLocale' , ( ) => {
133
144
const months = getMonths ( de , 'en' , 'long' ) ;
134
145
135
146
expect ( months ) . toHaveLength ( 12 ) ;
136
147
expect ( months [ 0 ] . text ) . toEqual ( 'Januar' ) ;
148
+ expect ( months [ 1 ] . text ) . toEqual ( 'Februar' ) ;
149
+ expect ( months [ 2 ] . text ) . toEqual ( 'März' ) ;
137
150
} ) ;
138
151
139
- it ( 'Should get month values by fallback to locale' , ( ) => {
152
+ it ( 'Should get long month values by fallback to locale' , ( ) => {
140
153
// Pass incorrect formatLocale
141
154
const months = getMonths ( null , 'de' , 'long' ) ;
142
155
143
156
expect ( months ) . toHaveLength ( 12 ) ;
144
157
expect ( months [ 0 ] . text ) . toEqual ( 'Januar' ) ;
158
+ expect ( months [ 1 ] . text ) . toEqual ( 'Februar' ) ;
159
+ expect ( months [ 2 ] . text ) . toEqual ( 'März' ) ;
160
+ } ) ;
161
+
162
+ it ( 'Should get short month values according to formatLocale' , ( ) => {
163
+ const months = getMonths ( de , 'en' , 'short' ) ;
164
+
165
+ expect ( months ) . toHaveLength ( 12 ) ;
166
+ expect ( months [ 0 ] . text ) . toEqual ( 'Jan' ) ;
167
+ expect ( months [ 1 ] . text ) . toEqual ( 'Feb' ) ;
168
+ expect ( months [ 2 ] . text ) . toEqual ( 'Mär' ) ;
169
+ } ) ;
170
+
171
+ it ( 'Should get short month values by fallback to locale' , ( ) => {
172
+ // @ts -expect-error Pass incorrect formatLocale
173
+ const months = getMonths ( { } , 'de' , 'short' ) ;
174
+
175
+ expect ( months ) . toHaveLength ( 12 ) ;
176
+ expect ( months [ 0 ] . text ) . toEqual ( 'Jan' ) ;
177
+ expect ( months [ 1 ] . text ) . toEqual ( 'Feb' ) ;
178
+ expect ( months [ 2 ] . text ) . toEqual ( 'Mär' ) ;
145
179
} ) ;
146
180
147
181
it ( 'Should get default pattern' , ( ) => {
0 commit comments