X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=9514a8edc4a818459af1d4755efac3b389d8beb5;hb=6bf51eea0489149c755f12007b585dc5521b46d3;hp=c8bf2ce4bd93e506215dc3669c52d943fec278d9;hpb=ba48be3ada51aee683ce5992c5f00a8458f385f8;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index c8bf2ce..9514a8e 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -298,19 +298,15 @@ test("ajax cache", function () { }); test("global ajaxSettings", function() { - expect(3); + expect(2); var tmp = jQuery.extend({}, jQuery.ajaxSettings); - var orig = { url: "data/with_fries.xml", data: null }; + var orig = { url: "data/with_fries.xml" }; var t; $.ajaxSetup({ data: {foo: 'bar', bar: 'BAR'} }); t = jQuery.extend({}, orig); - $.ajax(t); - ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending null" ); - - t = jQuery.extend({}, orig); t.data = {}; $.ajax(t); ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending {}" ); @@ -389,6 +385,30 @@ test("load(String, Function) - check file with only a script tag", function() { }); }); +test("load(String, Object, Function)", function() { + expect(2); + stop(); + + $('
').load(url('data/params_html.php'), { foo:3, bar:'ok' }, function() { + var $post = $(this).find('#post'); + equals( $post.find('#foo').text(), '3', 'Check if a hash of data is passed correctly'); + equals( $post.find('#bar').text(), 'ok', 'Check if a hash of data is passed correctly'); + start(); + }); +}); + +test("load(String, String, Function)", function() { + expect(2); + stop(); + + $('
').load(url('data/params_html.php'), 'foo=3&bar=ok', function() { + var $get = $(this).find('#get'); + equals( $get.find('#foo').text(), '3', 'Check if a string of data is passed correctly'); + equals( $get.find('#bar').text(), 'ok', 'Check if a of data is passed correctly'); + start(); + }); +}); + test("$.get(String, Hash, Function) - parse xml and use text() on nodes", function() { expect(2); stop(); @@ -811,6 +831,22 @@ test("custom timeout does not set error message when timeout occurs, see #970", }); }); +test("data option: evaluate function values (#2806)", function() { + stop(); + $.ajax({ + url: "data/echoQuery.php", + data: { + key: function() { + return "value"; + } + }, + success: function(result) { + equals( result, "key=value" ); + start(); + } + }) +}); + } //}