Skip to content

Commit

Permalink
Tests: Allow statusText to be "success" in AJAX tests
Browse files Browse the repository at this point in the history
In HTTP/2, status message is not supported and whatever is reported as
statusText differs between browsers. In Chrome & Safari it's "success", in
Firefox & IE it's "OK". So far "success" wasn't allowed. This made the tests
pass locally if you're running an HTTP/1.1 server but on TestSwarm which is
now proxied via an HTTP/2-equipped Cloudflare, the relevant test started failing
in Chrome & Safari.

Allow "success" to resolve the issue.

Closes gh-4973
  • Loading branch information
mgol committed Dec 1, 2021
1 parent e23190e commit 19ced96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/unit/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,8 @@ 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( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" );
assert.ok( [ "Hello", "OK", "success" ].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();
Expand Down

0 comments on commit 19ced96

Please sign in to comment.