diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js index e5f90863ec63071f191b82b0df7fdbba0ac411fa..3e99c1c454cf4b2261d99e3623f365570684a1e3 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2017 Magento. All rights reserved. * See COPYING.txt for license details. */ @@ -18,21 +18,23 @@ define([ config; beforeEach(function () { - element = $('<input />'); + element = $('<input />'); observable = ko.observable(); config = { - options : { + options: { dateFormat: 'M/d/yy', - 'storeLocale': 'en_US', - 'timeFormat': 'h:mm: a' + storeLocale: 'en_US', + timeFormat: 'h:mm: a' }, - storage:ko.observable(moment().format('MM/DD/YYYY')) + storage: observable }; $(document.body).append(element); - ko.applyBindingsToNode(element[0], { datepicker: config }); + ko.applyBindingsToNode(element[0], { + datepicker: config + }); }); afterEach(function () { @@ -40,20 +42,16 @@ define([ }); it('writes picked date\'s value to assigned observable', function () { - var todayDate, - momentFormat, - result, - inputFormat; - - inputFormat = 'M/d/yy'; + var todayDate, momentFormat, result, + inputFormat = 'M/d/yy'; momentFormat = utils.convertToMomentFormat(inputFormat); + todayDate = moment().format(momentFormat); - todayDate = moment().format(momentFormat); - - result = $('input:last').val(); + element.datepicker('setTimezoneDate').blur().trigger('change'); + result = moment(observable()).format(momentFormat); expect(todayDate).toEqual(result); }); }); -}); \ No newline at end of file +});