File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,33 @@ define([
187
187
expect ( model . setOptions ( data ) ) . toEqual ( model ) ;
188
188
expect ( model . setVisible ) . toHaveBeenCalled ( ) ;
189
189
expect ( model . toggleInput ) . toHaveBeenCalled ( ) ;
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' ] ] ) ;
190
217
} ) ;
191
218
} ) ;
192
219
describe ( 'getPreview method' , function ( ) {
You can’t perform that action at this time.
0 commit comments