File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
app/code/Magento/Ui/view/base/web/js/form/element
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ define([
44
44
if ( _ . isUndefined ( caption ) ) {
45
45
caption = node . label ;
46
46
}
47
+ } else {
48
+ return node ;
47
49
}
48
-
49
- return node ;
50
50
} ) ;
51
51
52
52
return {
Original file line number Diff line number Diff line change @@ -188,6 +188,39 @@ define([
188
188
expect ( model . setVisible ) . toHaveBeenCalled ( ) ;
189
189
expect ( model . toggleInput ) . toHaveBeenCalled ( ) ;
190
190
} ) ;
191
+ it ( 'Check call "parseOptions" method without predefined "captionValue" property' , function ( ) {
192
+ var data = [ {
193
+ value : null ,
194
+ label : 'label'
195
+ } , {
196
+ value : 'value'
197
+ } ] ;
198
+
199
+ model . options = jasmine . createSpy ( ) ;
200
+ model . caption = jasmine . createSpy ( ) . and . returnValue ( false ) ;
201
+
202
+ model . setOptions ( data ) ;
203
+ expect ( model . options ) . toHaveBeenCalledWith ( [ {
204
+ value : 'value'
205
+ } ] ) ;
206
+ expect ( model . caption . calls . allArgs ( ) ) . toEqual ( [ [ ] , [ 'label' ] ] ) ;
207
+
208
+ } ) ;
209
+ it ( 'Check call "parseOptions" method with predefined "captionValue" property' , function ( ) {
210
+ var data = [ {
211
+ value : 'value' ,
212
+ label : 'label'
213
+ } ] ;
214
+
215
+ model . options = jasmine . createSpy ( ) ;
216
+ model . caption = jasmine . createSpy ( ) . and . returnValue ( false ) ;
217
+ model . captionValue = 'value' ;
218
+
219
+ model . setOptions ( data ) ;
220
+ expect ( model . options ) . toHaveBeenCalledWith ( [ ] ) ;
221
+ expect ( model . caption . calls . allArgs ( ) ) . toEqual ( [ [ ] , [ 'label' ] ] ) ;
222
+
223
+ } ) ;
191
224
} ) ;
192
225
describe ( 'getPreview method' , function ( ) {
193
226
it ( 'check for default preview' , function ( ) {
You can’t perform that action at this time.
0 commit comments