[Commits] r2588 - in core/trunk/geoext: lib/overrides tests/lib/overrides

commits at geoext.org commits at geoext.org
Tue Feb 1 18:37:10 CET 2011


Author: ahocevar
Date: 2011-02-01 18:37:10 +0100 (Tue, 01 Feb 2011)
New Revision: 2588

Modified:
   core/trunk/geoext/lib/overrides/override-ext-ajax.js
   core/trunk/geoext/tests/lib/overrides/override-ext-ajax.html
Log:
Give callbacks a complete response object as argument. r=tschaub (closes #405)


Modified: core/trunk/geoext/lib/overrides/override-ext-ajax.js
===================================================================
--- core/trunk/geoext/lib/overrides/override-ext-ajax.js	2011-02-01 16:02:36 UTC (rev 2587)
+++ core/trunk/geoext/lib/overrides/override-ext-ajax.js	2011-02-01 17:37:10 UTC (rev 2588)
@@ -15,11 +15,9 @@
     var createComplete = function(fn, cb) {
         return function(request) {
             if(cb && cb[fn]) {
-                cb[fn].call(cb.scope || window, {
-                    responseText: request.responseText,
-                    responseXML: request.responseXML,
+                cb[fn].call(cb.scope || window, Ext.applyIf({
                     argument: cb.argument
-                });
+                }, request));
             }
         };
     };

Modified: core/trunk/geoext/tests/lib/overrides/override-ext-ajax.html
===================================================================
--- core/trunk/geoext/tests/lib/overrides/override-ext-ajax.html	2011-02-01 16:02:36 UTC (rev 2587)
+++ core/trunk/geoext/tests/lib/overrides/override-ext-ajax.html	2011-02-01 17:37:10 UTC (rev 2588)
@@ -25,7 +25,7 @@
         }
 
         function test_request(t) {
-            t.plan(7);
+            t.plan(9);
 
             /*
              * Setup
@@ -44,10 +44,10 @@
 
             var successObj, failureObj;
             var success = function(o) {
-                successObj = {scope: this, arg: o.argument};
+                successObj = {scope: this, arg: o.argument, status: o.status};
             };
             var failure = function(o) {
-                failureObj = {scope: this, arg: o.argument};
+                failureObj = {scope: this, arg: o.argument, status: o.status};
             };
 
             /*
@@ -82,6 +82,8 @@
                  "success cb called with proper scope");
             t.eq(successObj.arg, argument,
                  "success cb called with proper argument");
+            t.eq(successObj.status, 200,
+                "success cb called with proper status");
             proto.setRequestHeader = _srh;
 
             // test "failure" callback
@@ -107,6 +109,8 @@
                  "failure cb called with proper scope");
             t.eq(failureObj.arg, argument,
                  "failure cb called with proper argument");
+            t.eq(failureObj.status, 400,
+                 "failure cb called with proper status");
 
             // test xmlData
             // 1 test



More information about the Commits mailing list