]> source.dussan.org Git - jquery.git/commitdiff
Tests: Make Ajax tests pass in iOS 9
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Wed, 21 Sep 2022 15:46:18 +0000 (17:46 +0200)
committerGitHub <noreply@github.com>
Wed, 21 Sep 2022 15:46:18 +0000 (17:46 +0200)
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

index c4f3cc4c3ced6cf7deba01b488ea686669157266..546cc6d5f7814b64457c830d1fee9da8959a51b2 100644 (file)
@@ -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();