// Safari 3 randomly crashes when running these tests,
// but only in the full suite - you can run just the Ajax
// tests and they'll pass
-if ( !jQuery.browser.safari ) {
+//if ( !jQuery.browser.safari ) {
test("$.ajax() - success callbacks", function() {
expect( 8 );
foobar = null;
testFoo = undefined;
-
+
var verifyEvaluation = function() {
ok( testFoo == "foo", 'Check if script was evaluated for datatype html' );
ok( foobar == "bar", 'Check if script src was evaluated for datatype html' );
});
test("serialize()", function() {
- expect(1);
- // ignore button, IE takes text content as value, not relevant for this test
- equals( $(':input').not('button').serialize(),
- 'action=Test&text2=Test&radio1=on&radio2=on&check=on&=on&hidden=&foo%5Bbar%5D=&name=name&=foobar&select1=&select2=3&select3=1&test=&id=',
+ expect(6);
+
+ equals( $('#form').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1",
+ 'Check form serialization as query string');
+
+ equals( $('#form :input').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1",
+ 'Check input serialization as query string');
+
+ equals( $('#testForm').serialize(),
+ 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=',
'Check form serialization as query string');
+
+ equals( $('#testForm :input').serialize(),
+ 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=',
+ 'Check input serialization as query string');
+
+ equals( $('#form, #testForm').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+ 'Multiple form serialization as query string');
+
+ equals( $('#form, #testForm :input').serialize(),
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+ 'Mixed form/input serialization as query string');
});
test("$.param()", function() {
/* Test disabled, too many simultaneous requests
ok( $.get(url(target), success), "get" );
- ok( $.getIfModified(url(target), success), "getIfModified" );
ok( $.post(url(target), success), "post" );
ok( $.getScript(url("data/test.js"), success), "script" );
ok( $.getJSON(url("data/json_obj.js"), success), "json" );
});
});
-test("$.getIfModified(String, Hash, Function)", function() {
- expect(1);
- stop();
- $.getIfModified(url("data/name.html"), function(msg) {
- ok( /^ERROR/.test(msg), 'Check ifModified' );
- start();
- });
-});
-
test("$.getScript(String, Function) - with callback", function() {
expect(2);
stop();
});
});
-test("$.ajaxTimeout(Number) - with global timeout", function() {
+test("$.ajaxSetup({timeout: Number}) - with global timeout", function() {
stop();
var passed = 0;
- $.ajaxTimeout(1000);
+ $.ajaxSetup({timeout: 1000});
var pass = function() {
passed++;
});
// reset timeout
- $.ajaxTimeout(0);
+ $.ajaxSetup({timeout: 0});
});
-test("$.ajaxTimeout(Number) with localtimeout", function() {
- stop(); $.ajaxTimeout(50);
+test("$.ajaxSetup({timeout: Number}) with localtimeout", function() {
+ stop();
+ $.ajaxSetup({timeout: 50});
+
$.ajax({
type: "GET",
timeout: 5000,
start();
}
});
+
// reset timeout
- $.ajaxTimeout(0);
+ $.ajaxSetup({timeout: 0});
});
test("$.ajax - simple get", function() {
}
-}
+//}