aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-01-11 20:02:33 +0100
committerjaubourg <j@ubourg.net>2011-01-11 20:02:33 +0100
commit5a721cf31b142365954a2d71e860534da4536b16 (patch)
tree6c3afba4b4c9d0a9e9c0bd745bc651f42ed57d7c /test
parentc5c1f18adb4dfae5366eafada12ed02fe1b7064d (diff)
downloadjquery-5a721cf31b142365954a2d71e860534da4536b16.tar.gz
jquery-5a721cf31b142365954a2d71e860534da4536b16.zip
Fixes 4825. jQuery.fn.load: use the jXHR's Promise interface to get the actual response in case ajaxSettings contains a dataFilter. Unit test added.
Diffstat (limited to 'test')
-rw-r--r--test/unit/ajax.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 9f46c4134..1b5540216 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1025,6 +1025,18 @@ test("load(String, Function) - check file with only a script tag", function() {
});
});
+test("load(String, Function) - dataFilter in ajaxSettings", function() {
+ expect(2);
+ stop();
+ jQuery.ajaxSetup({ dataFilter: function() { return "Hello World"; } });
+ var div = jQuery("<div/>").load(url("data/name.html"), function(responseText) {
+ strictEqual( div.html(), "Hello World" , "Test div was filled with filtered data" );
+ strictEqual( responseText, "Hello World" , "Test callback receives filtered data" );
+ jQuery.ajaxSetup({ dataFilter: 0 });
+ start();
+ });
+});
+
test("load(String, Object, Function)", function() {
expect(2);
stop();