// tests and they'll pass
//if ( !jQuery.browser.safari ) {
+if ( !isLocal ) {
+
test("$.ajax() - success callbacks", function() {
expect( 8 );
}, 13);
});
-if ( !isLocal ) {
- test("$.ajax() - error callbacks", function() {
- expect( 8 );
- stop();
-
- $('#foo').ajaxStart(function(){
- ok( true, "ajaxStart" );
- }).ajaxStop(function(){
- ok( true, "ajaxStop" );
- start();
- }).ajaxSend(function(){
- ok( true, "ajaxSend" );
- }).ajaxComplete(function(){
- ok( true, "ajaxComplete" );
- }).ajaxError(function(){
- ok( true, "ajaxError" );
- }).ajaxSuccess(function(){
- ok( false, "ajaxSuccess" );
- });
-
- $.ajaxSetup({ timeout: 500 });
-
- $.ajax({
- url: url("data/name.php?wait=5"),
- beforeSend: function(){ ok(true, "beforeSend"); },
- success: function(){ ok(false, "success"); },
- error: function(){ ok(true, "error"); },
- complete: function(){ ok(true, "complete"); }
- });
- });
-}
+test("$.ajax() - error callbacks", function() {
+ expect( 8 );
+ stop();
+
+ $('#foo').ajaxStart(function(){
+ ok( true, "ajaxStart" );
+ }).ajaxStop(function(){
+ ok( true, "ajaxStop" );
+ start();
+ }).ajaxSend(function(){
+ ok( true, "ajaxSend" );
+ }).ajaxComplete(function(){
+ ok( true, "ajaxComplete" );
+ }).ajaxError(function(){
+ ok( true, "ajaxError" );
+ }).ajaxSuccess(function(){
+ ok( false, "ajaxSuccess" );
+ });
+
+ $.ajaxSetup({ timeout: 500 });
+
+ $.ajax({
+ url: url("data/name.php?wait=5"),
+ beforeSend: function(){ ok(true, "beforeSend"); },
+ success: function(){ ok(false, "success"); },
+ error: function(){ ok(true, "error"); },
+ complete: function(){ ok(true, "complete"); }
+ });
+});
test("$.ajax() - disabled globals", function() {
expect( 3 );
$.getScript(url("data/test.js"), start);
});
-if ( !isLocal ) {
-
test("$.ajax() - JSONP, Local", function() {
expect(7);
});
});
-test("$.post(String, Hash, Function) - simple with xml", function() {
+test("$.getJSON(String, Function) - Remote JSON object with assignment", function() {
expect(2);
+
+ var base = window.location.href.replace(/\?.*$/, "");
+
+ stop();
+ $.getJSON(base + "data/json_assigned_obj.js", function() {
+ ok( typeof json_assigned_obj == "object", 'Check JSON loaded' );
+ equals( json_assigned_obj.test, "worked", 'Check JSON obj.test' );
+ start();
+ });
+});
+
+test("$.post(String, Hash, Function) - simple with xml", function() {
+ expect(4);
stop();
$.post(url("data/name.php"), {xml: "5-2"}, function(xml){
$('math', xml).each(function() {
ok( $('calculation', this).text() == '5-2', 'Check for XML' );
ok( $('result', this).text() == '3', 'Check for XML' );
});
+ });
+
+ $.post(url("data/name.php?xml=5-2"), {}, function(xml){
+ $('math', xml).each(function() {
+ ok( $('calculation', this).text() == '5-2', 'Check for XML' );
+ ok( $('result', this).text() == '3', 'Check for XML' );
+ });
start();
});
});