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
This commit is contained in:
Michał Gołębiowski-Owczarek 2022-09-21 17:46:18 +02:00 committed by GitHub
parent c0db6d7032
commit d051e0e3a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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();