Skip to content

Commit 74ffd14

Browse files
committed
MAGETWO-62262: Truncation of year when saved without changes
- Updated datepicker.test.js to reflect changes in datepicker.js
1 parent e9b7e14 commit 74ffd14

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,46 @@ define([
1414

1515
describe('Datepicker binding', function () {
1616
var observable,
17-
element;
17+
element,
18+
config;
1819

1920
beforeEach(function () {
2021
element = $('<input />');
2122
observable = ko.observable();
2223

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+
2333
$(document.body).append(element);
2434

25-
ko.applyBindingsToNode(element[0], {
26-
datepicker: observable
27-
});
35+
ko.applyBindingsToNode(element[0], { datepicker: config });
2836
});
2937

3038
afterEach(function () {
3139
element.remove();
3240
});
3341

3442
it('writes picked date\'s value to assigned observable', function () {
35-
var openBtn,
36-
todayBtn,
37-
todayDate,
43+
var todayDate,
44+
momentFormat,
3845
result,
39-
inputFormat,
40-
momentFormat;
46+
inputFormat;
4147

4248
inputFormat = 'M/d/yy';
43-
momentFormat = utils.convertToMomentFormat(inputFormat);
44-
todayDate = moment().format(momentFormat);
4549

46-
openBtn = $('img.ui-datepicker-trigger');
47-
todayBtn = $('[data-handler="today"]');
50+
momentFormat = utils.convertToMomentFormat(inputFormat);
4851

49-
openBtn.click();
50-
todayBtn.click();
52+
todayDate = moment().format(momentFormat);
5153

52-
result = moment(observable()).format(momentFormat);
54+
result = $('input').val();
5355

5456
expect(todayDate).toEqual(result);
5557
});
5658
});
57-
});
59+
});

0 commit comments

Comments
 (0)