Skip to content

Commit adcc5f5

Browse files
committed
ACP2E-4338: Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config)
1 parent fe3ad0a commit adcc5f5

File tree

1 file changed

+35
-3
lines changed
  • dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns

1 file changed

+35
-3
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/date.test.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2015 Adobe
3+
* All Rights Reserved.
44
*/
55

66
/*eslint max-nested-callbacks: 0*/
77
define([
88
'underscore',
9+
'moment',
910
'Magento_Ui/js/grid/columns/date'
10-
], function (_, Date) {
11+
], function (_, moment, Date) {
1112
'use strict';
1213

1314
describe('Ui/js/grid/columns/date', function () {
@@ -28,5 +29,36 @@ define([
2829
expect(date.dateFormat).toBeDefined();
2930
});
3031
});
32+
33+
describe('getLabel method', function () {
34+
it('uses moment.updateLocale when storeLocale is defined', function () {
35+
var value,
36+
label;
37+
38+
date.storeLocale = 'en_US';
39+
date.calendarConfig = {
40+
week: { dow: 1 }
41+
};
42+
date.index = 'created_at';
43+
44+
date._super = function () {
45+
return '2025-11-18 15:30:00';
46+
};
47+
48+
value = {
49+
created_at: '2025-11-18 15:30:00'
50+
};
51+
52+
spyOn(moment, 'updateLocale').and.callThrough();
53+
54+
label = date.getLabel(value, 'YYYY-MM-DD');
55+
56+
expect(moment.updateLocale).toHaveBeenCalledWith(
57+
'en_US',
58+
jasmine.any(Object)
59+
);
60+
expect(label).toBe('2025-11-18');
61+
});
62+
});
3163
});
3264
});

0 commit comments

Comments
 (0)