File tree Expand file tree Collapse file tree 2 files changed +29
-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 +29
-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,33 @@ 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
+ model . options = jasmine . createSpy ( ) ;
199
+ model . caption = jasmine . createSpy ( ) . and . returnValue ( false ) ;
200
+ model . setOptions ( data ) ;
201
+ expect ( model . options ) . toHaveBeenCalledWith ( [ {
202
+ value : 'value'
203
+ } ] ) ;
204
+ expect ( model . caption . calls . allArgs ( ) ) . toEqual ( [ [ ] , [ 'label' ] ] ) ;
205
+ } ) ;
206
+ it ( 'Check call "parseOptions" method with predefined "captionValue" property' , function ( ) {
207
+ var data = [ {
208
+ value : 'value' ,
209
+ label : 'label'
210
+ } ] ;
211
+ model . options = jasmine . createSpy ( ) ;
212
+ model . caption = jasmine . createSpy ( ) . and . returnValue ( false ) ;
213
+ model . captionValue = 'value' ;
214
+ model . setOptions ( data ) ;
215
+ expect ( model . options ) . toHaveBeenCalledWith ( [ ] ) ;
216
+ expect ( model . caption . calls . allArgs ( ) ) . toEqual ( [ [ ] , [ 'label' ] ] ) ;
217
+ } ) ;
191
218
} ) ;
192
219
describe ( 'getPreview method' , function ( ) {
193
220
it ( 'check for default preview' , function ( ) {
You can’t perform that action at this time.
0 commit comments