File tree Expand file tree Collapse file tree 1 file changed +21
-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 +21
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,27 @@ define([
358
358
} ) ;
359
359
} ) ;
360
360
361
+ describe ( 'onFail handler' , function ( ) {
362
+ it ( 'it logs responseText and status' , function ( ) {
363
+ spyOn ( console , 'error' ) ;
364
+
365
+ var fakeEvent = {
366
+ target : document . createElement ( 'input' )
367
+ } ,
368
+ data = {
369
+ jqXHR : {
370
+ responseText : 'Failed' ,
371
+ status : '500'
372
+ }
373
+ } ;
374
+
375
+ component . onFail ( fakeEvent , data ) ;
376
+ expect ( console . error ) . toHaveBeenCalledWith ( data . jqXHR . responseText ) ;
377
+ expect ( console . error ) . toHaveBeenCalledWith ( data . jqXHR . status ) ;
378
+ expect ( console . error ) . toHaveBeenCalledTimes ( 2 ) ;
379
+ } ) ;
380
+ } ) ;
381
+
361
382
describe ( 'aggregateError method' , function ( ) {
362
383
it ( 'should append onto aggregatedErrors array when called' , function ( ) {
363
384
spyOn ( component . aggregatedErrors , 'push' ) ;
You can’t perform that action at this time.
0 commit comments