Skip to content

Commit e9b7e14

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

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ define([
77
'ko',
88
'jquery',
99
'moment',
10+
'mageUtils',
1011
'Magento_Ui/js/lib/knockout/bindings/datepicker'
11-
], function (ko, $, moment) {
12+
], function (ko, $, moment, utils) {
1213
'use strict';
1314

1415
describe('Datepicker binding', function () {
@@ -21,7 +22,9 @@ define([
2122

2223
$(document.body).append(element);
2324

24-
ko.applyBindingsToNode(element[0], { datepicker: observable });
25+
ko.applyBindingsToNode(element[0], {
26+
datepicker: observable
27+
});
2528
});
2629

2730
afterEach(function () {
@@ -32,21 +35,23 @@ define([
3235
var openBtn,
3336
todayBtn,
3437
todayDate,
35-
dateFormat,
36-
result;
38+
result,
39+
inputFormat,
40+
momentFormat;
3741

38-
dateFormat = element.datepicker('option', 'dateFormat');
39-
todayDate = moment().format(dateFormat);
42+
inputFormat = 'M/d/yy';
43+
momentFormat = utils.convertToMomentFormat(inputFormat);
44+
todayDate = moment().format(momentFormat);
4045

4146
openBtn = $('img.ui-datepicker-trigger');
4247
todayBtn = $('[data-handler="today"]');
4348

4449
openBtn.click();
4550
todayBtn.click();
4651

47-
result = moment(observable()).format(dateFormat);
52+
result = moment(observable()).format(momentFormat);
4853

4954
expect(todayDate).toEqual(result);
5055
});
5156
});
52-
});
57+
});

0 commit comments

Comments
 (0)