@@ -542,28 +542,30 @@ QUnit.test( "jQuery.Deferred.then - spec compatibility", function( assert ) {
542
542
} catch ( _ ) { }
543
543
} ) ;
544
544
545
+ // Test fails in IE9 but is skipped there because console is not active
545
546
QUnit [ window . console ? "test" : "skip" ] ( "jQuery.Deferred.exceptionHook" , function ( assert ) {
546
547
547
- assert . expect ( 1 ) ;
548
+ assert . expect ( 2 ) ;
548
549
549
550
var done = assert . async ( ) ,
550
551
defer = jQuery . Deferred ( ) ,
551
552
oldWarn = window . console . warn ;
552
553
553
- window . console . warn = function ( msg ) {
554
+ window . console . warn = function ( ) {
554
555
555
556
// Support: Chrome <=41 only
556
557
// Some Chrome versions newer than 30 but older than 42 display the "undefined is
557
558
// not a function" error, not mentioning the function name. This has been fixed
558
559
// in Chrome 42. Relax this test there.
559
560
// This affects our Android 5.0 & Yandex.Browser testing.
560
- var oldChromium = false ;
561
+ var msg = Array . prototype . join . call ( arguments , " " ) ,
562
+ oldChromium = false ;
561
563
if ( / c h r o m e / i. test ( navigator . userAgent ) ) {
562
564
oldChromium = parseInt (
563
565
navigator . userAgent . match ( / c h r o m e \/ ( \d + ) / i ) [ 1 ] , 10 ) < 42 ;
564
566
}
565
567
if ( oldChromium ) {
566
- assert . ok ( / (?: b a r f | u n d e f i n e d ) / . test ( msg ) , "Message: " + msg ) ;
568
+ assert . ok ( / (?: b a r f | u n d e f i n e d ) / . test ( msg ) , "Message (weak assertion) : " + msg ) ;
567
569
} else {
568
570
assert . ok ( / b a r f / . test ( msg ) , "Message: " + msg ) ;
569
571
}
@@ -580,14 +582,17 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook", func
580
582
// Should NOT get an error
581
583
throw new Error ( "Make me a sandwich" ) ;
582
584
} ) . then ( null , jQuery . noop )
583
- ) . then ( function ( ) {
585
+ ) . then ( function barf ( ) {
586
+ jQuery . thisDiesToo ( ) ;
587
+ } ) . then ( null , function ( ) {
584
588
window . console . warn = oldWarn ;
585
589
done ( ) ;
586
590
} ) ;
587
591
588
592
defer . resolve ( ) ;
589
593
} ) ;
590
594
595
+ // Test fails in IE9 but is skipped there because console is not active
591
596
QUnit [ window . console ? "test" : "skip" ] ( "jQuery.Deferred.exceptionHook with stack hooks" , function ( assert ) {
592
597
593
598
assert . expect ( 2 ) ;
@@ -605,24 +610,26 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook with s
605
610
return "NO STACK FOR YOU" ;
606
611
} ;
607
612
608
- window . console . warn = function ( msg , stack ) {
613
+ window . console . warn = function ( ) {
609
614
610
615
// Support: Chrome <=41 only
611
616
// Some Chrome versions newer than 30 but older than 42 display the "undefined is
612
617
// not a function" error, not mentioning the function name. This has been fixed
613
618
// in Chrome 42. Relax this test there.
614
619
// This affects our Android 5.0 & Yandex.Browser testing.
615
- var oldChromium = false ;
620
+ var msg = Array . prototype . join . call ( arguments , " " ) ,
621
+ oldChromium = false ;
616
622
if ( / c h r o m e / i. test ( navigator . userAgent ) ) {
617
623
oldChromium = parseInt (
618
624
navigator . userAgent . match ( / c h r o m e \/ ( \d + ) / i ) [ 1 ] , 10 ) < 42 ;
619
625
}
620
626
if ( oldChromium ) {
621
- assert . ok ( / (?: c o u g h _ u p _ h a i r b a l l | u n d e f i n e d ) / . test ( msg ) , "Function mentioned: " + msg ) ;
627
+ assert . ok ( / (?: c o u g h _ u p _ h a i r b a l l | u n d e f i n e d ) / . test ( msg ) ,
628
+ "Function mentioned (weak assertion): " + msg ) ;
622
629
} else {
623
630
assert . ok ( / c o u g h _ u p _ h a i r b a l l / . test ( msg ) , "Function mentioned: " + msg ) ;
624
631
}
625
- assert . ok ( / N O S T A C K F O R Y O U / . test ( stack ) , "Stack trace included: " + stack ) ;
632
+ assert . ok ( / N O S T A C K F O R Y O U / . test ( msg ) , "Stack trace included: " + msg ) ;
626
633
} ;
627
634
defer . then ( function ( ) {
628
635
jQuery . cough_up_hairball ( ) ;
0 commit comments