File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -18,42 +18,40 @@ define([
18
18
config ;
19
19
20
20
beforeEach ( function ( ) {
21
- element = $ ( '<input />' ) ;
21
+ element = $ ( '<input />' ) ;
22
22
observable = ko . observable ( ) ;
23
23
24
24
config = {
25
- options : {
26
- dateFormat : 'M/d/yy' ,
25
+ options : {
26
+ ' dateFormat' : 'M/d/yy' ,
27
27
'storeLocale' : 'en_US' ,
28
28
'timeFormat' : 'h:mm: a'
29
29
} ,
30
- storage :ko . observable ( moment ( ) . format ( 'MM/DD/YYYY' ) )
30
+ storage : observable
31
31
} ;
32
32
33
33
$ ( document . body ) . append ( element ) ;
34
34
35
- ko . applyBindingsToNode ( element [ 0 ] , { datepicker : config } ) ;
35
+ ko . applyBindingsToNode ( element [ 0 ] , {
36
+ datepicker : config
37
+ } ) ;
36
38
} ) ;
37
39
38
40
afterEach ( function ( ) {
39
41
element . remove ( ) ;
40
42
} ) ;
41
43
42
44
it ( 'writes picked date\'s value to assigned observable' , function ( ) {
43
- var todayDate ,
44
- momentFormat ,
45
- result ,
46
- inputFormat ;
47
-
48
- inputFormat = 'M/d/yy' ;
45
+ var todayDate , momentFormat , result ,
46
+ inputFormat = 'M/d/yy' ;
49
47
50
48
momentFormat = utils . convertToMomentFormat ( inputFormat ) ;
49
+ todayDate = moment ( ) . format ( momentFormat ) ;
51
50
52
- todayDate = moment ( ) . format ( momentFormat ) ;
53
-
54
- result = $ ( 'input:last' ) . val ( ) ;
51
+ element . datepicker ( 'setTimezoneDate' ) . blur ( ) . trigger ( 'change' ) ;
52
+ result = moment ( observable ( ) ) . format ( momentFormat ) ;
55
53
56
54
expect ( todayDate ) . toEqual ( result ) ;
57
55
} ) ;
58
56
} ) ;
59
- } ) ;
57
+ } ) ;
You can’t perform that action at this time.
0 commit comments