});
});
+test("jQuery.getJSON - Using Native JSON", function() {
+ expect(2);
+
+ var old = window.JSON;
+ JSON = {
+ parse: function(str){
+ ok( true, "Verifying that parse method was run" );
+ return true;
+ }
+ };
+
+ stop();
+ jQuery.getJSON(url("data/json.php"), function(json) {
+ window.JSON = old;
+ equals( json, true, "Verifying return value" );
+ start();
+ });
+});
+
test("jQuery.getJSON(String, Function) - JSON object with absolute url to local content", function() {
expect(2);
jQuery.ajax({
type: "GET",
- timeout: 5000,
+ timeout: 15000,
url: url("data/name.php?wait=1"),
error: function() {
ok( false, 'Check for local timeout failed' );
})
});
+test("jQuery.ajax - If-Modified-Since support", function() {
+ expect( 3 );
+
+ stop();
+
+ var url = "data/if_modified_since.php?ts=" + new Date();
+
+ jQuery.ajax({
+ url: url,
+ ifModified: true,
+ success: function(data, status) {
+ equals(status, "success");
+
+ jQuery.ajax({
+ url: url,
+ ifModified: true,
+ success: function(data, status) {
+ if ( data === "FAIL" ) {
+ ok(true, "Opera is incapable of doing .setRequestHeader('If-Modified-Since').");
+ ok(true, "Opera is incapable of doing .setRequestHeader('If-Modified-Since').");
+ } else {
+ equals(status, "notmodified");
+ ok(data == null, "response body should be empty")
+ }
+ start();
+ }
+ });
+ }
+ });
+});
+
+test("jQuery.ajax - Etag support", function() {
+ expect( 3 );
+
+ stop();
+
+ var url = "data/etag.php?ts=" + new Date();
+
+ jQuery.ajax({
+ url: url,
+ ifModified: true,
+ success: function(data, status) {
+ equals(status, "success");
+
+ jQuery.ajax({
+ url: url,
+ ifModified: true,
+ success: function(data, status) {
+ if ( data === "FAIL" ) {
+ ok(true, "Opera is incapable of doing .setRequestHeader('If-None-Match').");
+ ok(true, "Opera is incapable of doing .setRequestHeader('If-None-Match').");
+ } else {
+ equals(status, "notmodified");
+ ok(data == null, "response body should be empty")
+ }
+ start();
+ }
+ });
+ }
+ });
+});
+
}
//}