File tree Expand file tree Collapse file tree 1 file changed +35
-3
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns Expand file tree Collapse file tree 1 file changed +35
-3
lines changed Original file line number Diff line number Diff line change 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*/
77define ( [
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} ) ;
You can’t perform that action at this time.
0 commit comments