File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
app/code/Magento/Ui/view/base/web/js/form/element
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ define([
196
196
197
197
newFormat = format . replace ( / y y | y / gi, 'YYYY' ) ; // replace the year
198
198
newFormat = newFormat . replace ( / d d | d / g, 'DD' ) ; // replace the date
199
- newFormat = newFormat . replace ( / m m | m / g , 'MM' ) ; //replace the month
199
+ newFormat = newFormat . replace ( / m m | m / gi , 'MM' ) ; //replace the month
200
200
201
201
return newFormat ;
202
202
}
Original file line number Diff line number Diff line change 6
6
/*eslint max-nested-callbacks: 0*/
7
7
8
8
define ( [
9
- 'Magento_Ui/js/form/element/date'
10
- ] , function ( DateElement ) {
9
+ 'Magento_Ui/js/form/element/date' ,
10
+ 'mageUtils'
11
+ ] , function ( DateElement , utils ) {
11
12
'use strict' ;
12
13
13
14
describe ( 'Magento_Ui/js/form/element/date' , function ( ) {
@@ -19,5 +20,23 @@ define([
19
20
} ;
20
21
model = new DateElement ( params ) ;
21
22
} ) ;
23
+
24
+ it ( 'Check convertToMomentFormat function' , function ( ) {
25
+ var format ,
26
+ momentFormat ;
27
+
28
+ format = 'M/d/yy' ;
29
+ momentFormat = 'MM/DD/YYYY' ;
30
+ expect ( model . convertToMomentFormat ( format ) ) . toBe ( momentFormat ) ;
31
+ } ) ;
32
+
33
+ it ( 'Check prepareDateTimeFormats function' , function ( ) {
34
+ spyOn ( model , 'convertToMomentFormat' ) ;
35
+ spyOn ( utils , 'normalizeDate' ) ;
36
+ model . prepareDateTimeFormats ( ) ;
37
+ expect ( model . convertToMomentFormat ) . toHaveBeenCalled ( ) ;
38
+ expect ( utils . normalizeDate ) . toHaveBeenCalled ( ) ;
39
+ } ) ;
40
+
22
41
} ) ;
23
42
} ) ;
You can’t perform that action at this time.
0 commit comments