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