aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-01-25 16:08:19 +0100
committerjaubourg <j@ubourg.net>2011-01-25 16:08:19 +0100
commit5ca8f0617f5c94495380ff783452a52eab706d39 (patch)
treea369935e3c91af39c4e34949b25e001b0dd8f987 /test/unit/ajax.js
parent8d050558d3dc2c0abd0bde4bc9d03bfb66974689 (diff)
downloadjquery-5ca8f0617f5c94495380ff783452a52eab706d39.tar.gz
jquery-5ca8f0617f5c94495380ff783452a52eab706d39.zip
Reworks how values of parameters passed to error callbacks are determined. Fixes #8050.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index b44f0773f..d01837239 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -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 );