From d051e0e3a2aac3d5cf671b180fdf7b92d627a5bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Wed, 21 Sep 2022 17:46:18 +0200 Subject: [PATCH] Tests: Make Ajax tests pass in iOS 9 Accept "HTTP/2.0 200" as a valid `statusText` for successful requests to make ajax tests pass in iOS 9. At this point, normalizing this in code doesn't seem to make a lot of sense. Closes gh-5121 --- test/unit/ajax.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/unit/ajax.js b/test/unit/ajax.js index c4f3cc4c3..546cc6d5f 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1640,8 +1640,14 @@ QUnit.module( "ajax", { var done = assert.async(); jQuery.ajax( url( "mock.php?action=status&code=200&text=Hello" ) ).done( function( _, statusText, jqXHR ) { assert.strictEqual( statusText, "success", "callback status text ok for success" ); - assert.ok( [ "Hello", "OK", "success" ].indexOf( jqXHR.statusText ) > -1, + + // Support: iOS 9 only + // Some versions of iOS 9 return the "HTTP/2.0 200" status text + // in this case; accept it. + assert.ok( + [ "Hello", "OK", "success", "HTTP/2.0 200" ].indexOf( jqXHR.statusText ) > -1, "jqXHR status text ok for success (" + jqXHR.statusText + ")" ); + jQuery.ajax( url( "mock.php?action=status&code=404&text=World" ) ).fail( function( jqXHR, statusText ) { assert.strictEqual( statusText, "error", "callback status text ok for error" ); done(); -- 2.39.5