X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=inline;f=test%2Funit%2Fajax.js;h=61992706d59dbef8e17760f9706844b73a74b77b;hb=e63fa8beb8e285fe19fc0a1557045b80e3c63c66;hp=b7eb57d8e841ea458beb41069cff70fe2863e51f;hpb=f9f9ee52e16f37900296e06982a7dccba89c5a78;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index b7eb57d..6199270 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -390,7 +390,7 @@ test("serialize()", function() { }); test("jQuery.param()", function() { - expect(19); + expect(22); equals( !jQuery.ajaxSettings.traditional, true, "traditional flag, falsy by default" ); @@ -419,6 +419,11 @@ test("jQuery.param()", function() { equals( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" ); equals( decodeURIComponent( jQuery.param({ a: [1,2,3], 'b[]': [4,5,6], 'c[d]': [7,8,9], e: { f: [10], g: [11,12], h: 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." ); + + // Make sure empty arrays and objects are handled #6481 + equals( jQuery.param({"foo": {"bar": []} }), "foo%5Bbar%5D=", "Empty array param" ); + equals( jQuery.param({"foo": {"bar": [], foo: 1} }), "foo%5Bbar%5D=&foo%5Bfoo%5D=1", "Empty array param" ); + equals( jQuery.param({"foo": {"bar": {}} }), "foo%5Bbar%5D=", "Empty object param" ); jQuery.ajaxSetup({ traditional: true }); @@ -1242,8 +1247,16 @@ test("jQuery.ajax - If-Modified-Since support", function() { ok(data == null, "response body should be empty") } start(); + }, + error: function() { + equals(false, "error"); + start(); } }); + }, + error: function() { + equals(false, "error"); + start(); } }); }); @@ -1273,13 +1286,20 @@ test("jQuery.ajax - Etag support", function() { ok(data == null, "response body should be empty") } start(); + }, + error: function() { + equals(false, "error"); + start(); } }); + }, + error: function() { + equals(false, "error"); + start(); } }); }); - test("jQuery.ajax - active counter", function() { ok( jQuery.ajax.active == 0, "ajax active counter should be zero: " + jQuery.ajax.active ); });