Reworks how values of parameters passed to error callbacks are determined. Fixes #8050.
This commit is contained in:
parent
8d050558d3
commit
5ca8f0617f
3 changed files with 60 additions and 12 deletions
|
@ -240,6 +240,47 @@ test("jQuery.ajax() - error callbacks", function() {
|
|||
});
|
||||
});
|
||||
|
||||
test("jQuery.ajax() - textStatus and errorThrown values", function() {
|
||||
|
||||
var nb = 3;
|
||||
|
||||
expect( 2 * nb );
|
||||
stop();
|
||||
|
||||
function startN() {
|
||||
if ( !( --nb ) ) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: url("data/nonExistingURL"),
|
||||
error: function( _ , textStatus , errorThrown ){
|
||||
strictEqual( textStatus, "error", "textStatus is 'error' for 404" );
|
||||
strictEqual( errorThrown, "Not Found", "errorThrown is 'Not Found' for 404");
|
||||
startN();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.ajax({
|
||||
url: url("data/name.php?wait=5"),
|
||||
error: function( _ , textStatus , errorThrown ){
|
||||
strictEqual( textStatus, "abort", "textStatus is 'abort' for abort" );
|
||||
strictEqual( errorThrown, "abort", "errorThrown is 'abort' for abort");
|
||||
startN();
|
||||
}
|
||||
}).abort();
|
||||
|
||||
jQuery.ajax({
|
||||
url: url("data/name.php?wait=5"),
|
||||
error: function( _ , textStatus , errorThrown ){
|
||||
strictEqual( textStatus, "mystatus", "textStatus is 'mystatus' for abort('mystatus')" );
|
||||
strictEqual( errorThrown, "mystatus", "errorThrown is 'mystatus' for abort('mystatus')");
|
||||
startN();
|
||||
}
|
||||
}).abort( "mystatus" );
|
||||
});
|
||||
|
||||
test("jQuery.ajax() - responseText on error", function() {
|
||||
|
||||
expect( 1 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue