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([
358358 } ) ;
359359 } ) ;
360360
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+
361382 describe ( 'aggregateError method' , function ( ) {
362383 it ( 'should append onto aggregatedErrors array when called' , function ( ) {
363384 spyOn ( component . aggregatedErrors , 'push' ) ;
You can’t perform that action at this time.
0 commit comments