aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorTrey Hunner <treyhunner@gmail.com>2012-05-18 13:28:50 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-05-18 13:28:50 -0400
commitf1dcaad09736c194f9148e5bf5fb08498a483a7a (patch)
treec4de3c9b5b52643e6cf894a2154101b23dafa53c /test/unit
parentc4df0c91bed4358ddca4b493afc06c69e5b501f0 (diff)
downloadjquery-f1dcaad09736c194f9148e5bf5fb08498a483a7a.tar.gz
jquery-f1dcaad09736c194f9148e5bf5fb08498a483a7a.zip
Fix indentation in /speed and /test dirs, closes gh-780.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/ajax.js190
-rw-r--r--test/unit/core.js104
2 files changed, 147 insertions, 147 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index d9c4c33e7..62677697b 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -769,8 +769,8 @@ test("jQuery.ajax() - disabled globals", function() {
success: function(){ ok(true, "success"); },
error: function(){ ok(false, "error"); },
complete: function(){
- ok(true, "complete");
- setTimeout(function(){ start(); }, 13);
+ ok(true, "complete");
+ setTimeout(function(){ start(); }, 13);
}
});
});
@@ -779,14 +779,14 @@ test("jQuery.ajax - xml: non-namespace elements inside namespaced elements", fun
expect(3);
stop();
jQuery.ajax({
- url: url("data/with_fries.xml"),
- dataType: "xml",
- success: function(resp) {
- equal( jQuery("properties", resp).length, 1, "properties in responseXML" );
- equal( jQuery("jsconf", resp).length, 1, "jsconf in responseXML" );
- equal( jQuery("thing", resp).length, 2, "things in responseXML" );
- start();
- }
+ url: url("data/with_fries.xml"),
+ dataType: "xml",
+ success: function(resp) {
+ equal( jQuery("properties", resp).length, 1, "properties in responseXML" );
+ equal( jQuery("jsconf", resp).length, 1, "jsconf in responseXML" );
+ equal( jQuery("thing", resp).length, 2, "things in responseXML" );
+ start();
+ }
});
});
@@ -794,18 +794,18 @@ test("jQuery.ajax - xml: non-namespace elements inside namespaced elements (over
expect(3);
stop();
jQuery.ajax({
- url: url("data/with_fries_over_jsonp.php"),
- dataType: "jsonp xml",
- success: function(resp) {
- equal( jQuery("properties", resp).length, 1, "properties in responseXML" );
- equal( jQuery("jsconf", resp).length, 1, "jsconf in responseXML" );
- equal( jQuery("thing", resp).length, 2, "things in responseXML" );
- start();
- },
- error: function(_1,_2,error) {
- ok( false, error );
- start();
- }
+ url: url("data/with_fries_over_jsonp.php"),
+ dataType: "jsonp xml",
+ success: function(resp) {
+ equal( jQuery("properties", resp).length, 1, "properties in responseXML" );
+ equal( jQuery("jsconf", resp).length, 1, "jsconf in responseXML" );
+ equal( jQuery("thing", resp).length, 2, "things in responseXML" );
+ start();
+ },
+ error: function(_1,_2,error) {
+ ok( false, error );
+ start();
+ }
});
});
@@ -914,13 +914,13 @@ test("jQuery.ajax - dataType html", function() {
};
jQuery.ajax({
- dataType: "html",
- url: url("data/test.html"),
- success: function(data) {
- jQuery("#ap").html(data);
- ok( data.match(/^html text/), "Check content for datatype html" );
- setTimeout(verifyEvaluation, 600);
- }
+ dataType: "html",
+ url: url("data/test.html"),
+ success: function(data) {
+ jQuery("#ap").html(data);
+ ok( data.match(/^html text/), "Check content for datatype html" );
+ setTimeout(verifyEvaluation, 600);
+ }
});
});
@@ -953,7 +953,7 @@ test("serialize()", function() {
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Multiple form serialization as query string");
- /* Temporarily disabled. Opera 10 has problems with form serialization.
+ /* Temporarily disabled. Opera 10 has problems with form serialization.
equal( jQuery("#form, #testForm :input").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Mixed form/input serialization as query string");
@@ -1741,7 +1741,7 @@ test("jQuery.ajax() - malformed JSON", function() {
error: function(xhr, msg, detailedMsg) {
equal( "parsererror", msg, "A parse error occurred." );
ok( /(invalid|error|exception)/i.test(detailedMsg), "Detailed parsererror message provided" );
- start();
+ start();
}
});
});
@@ -1777,12 +1777,12 @@ test("jQuery.ajax() - json by content-type", function() {
url: "data/json.php",
data: { header: "json", json: "array" },
success: function( json ) {
- ok( json.length >= 2, "Check length");
- equal( json[0].name, "John", "Check JSON: first, name" );
- equal( json[0].age, 21, "Check JSON: first, age" );
- equal( json[1].name, "Peter", "Check JSON: second, name" );
- equal( json[1].age, 25, "Check JSON: second, age" );
- start();
+ ok( json.length >= 2, "Check length");
+ equal( json[0].name, "John", "Check JSON: first, name" );
+ equal( json[0].age, 21, "Check JSON: first, age" );
+ equal( json[1].name, "Peter", "Check JSON: second, name" );
+ equal( json[1].age, 25, "Check JSON: second, age" );
+ start();
}
});
});
@@ -1801,12 +1801,12 @@ test("jQuery.ajax() - json by content-type disabled with options", function() {
success: function( text ) {
equal( typeof text , "string" , "json wasn't auto-determined" );
var json = jQuery.parseJSON( text );
- ok( json.length >= 2, "Check length");
- equal( json[0].name, "John", "Check JSON: first, name" );
- equal( json[0].age, 21, "Check JSON: first, age" );
- equal( json[1].name, "Peter", "Check JSON: second, name" );
- equal( json[1].age, 25, "Check JSON: second, age" );
- start();
+ ok( json.length >= 2, "Check length");
+ equal( json[0].name, "John", "Check JSON: first, name" );
+ equal( json[0].age, 21, "Check JSON: first, age" );
+ equal( json[1].name, "Peter", "Check JSON: second, name" );
+ equal( json[1].age, 25, "Check JSON: second, age" );
+ start();
}
});
});
@@ -1815,12 +1815,12 @@ test("jQuery.getJSON(String, Hash, Function) - JSON array", function() {
expect(5);
stop();
jQuery.getJSON(url("data/json.php"), {json: "array"}, function(json) {
- ok( json.length >= 2, "Check length");
- equal( json[0].name, "John", "Check JSON: first, name" );
- equal( json[0].age, 21, "Check JSON: first, age" );
- equal( json[1].name, "Peter", "Check JSON: second, name" );
- equal( json[1].age, 25, "Check JSON: second, age" );
- start();
+ ok( json.length >= 2, "Check length");
+ equal( json[0].name, "John", "Check JSON: first, name" );
+ equal( json[0].age, 21, "Check JSON: first, age" );
+ equal( json[1].name, "Peter", "Check JSON: second, name" );
+ equal( json[1].age, 25, "Check JSON: second, age" );
+ start();
});
});
@@ -1828,11 +1828,11 @@ test("jQuery.getJSON(String, Function) - JSON object", function() {
expect(2);
stop();
jQuery.getJSON(url("data/json.php"), function(json) {
- if (json && json.data) {
- equal( json.data.lang, "en", "Check JSON: lang" );
- equal( json.data.length, 25, "Check JSON: length" );
- }
- start();
+ if (json && json.data) {
+ equal( json.data.lang, "en", "Check JSON: lang" );
+ equal( json.data.length, 25, "Check JSON: length" );
+ }
+ start();
});
});
@@ -1862,9 +1862,9 @@ test("jQuery.getJSON(String, Function) - JSON object with absolute url to local
stop();
jQuery.getJSON(url(base + "data/json.php"), function(json) {
- equal( json.data.lang, "en", "Check JSON: lang" );
- equal( json.data.length, 25, "Check JSON: length" );
- start();
+ equal( json.data.lang, "en", "Check JSON: lang" );
+ equal( json.data.length, 25, "Check JSON: length" );
+ start();
});
});
@@ -1904,19 +1904,19 @@ test("jQuery.post(String, Hash, Function) - simple with xml", function() {
var done = 0;
jQuery.post(url("data/name.php"), {xml: "5-2"}, function(xml){
- jQuery("math", xml).each(function() {
+ jQuery("math", xml).each(function() {
equal( jQuery("calculation", this).text(), "5-2", "Check for XML" );
equal( jQuery("result", this).text(), "3", "Check for XML" );
- });
- if ( ++done === 2 ) start();
+ });
+ if ( ++done === 2 ) start();
});
jQuery.post(url("data/name.php?xml=5-2"), {}, function(xml){
- jQuery("math", xml).each(function() {
+ jQuery("math", xml).each(function() {
equal( jQuery("calculation", this).text(), "5-2", "Check for XML" );
equal( jQuery("result", this).text(), "3", "Check for XML" );
- });
- if ( ++done === 2 ) start();
+ });
+ if ( ++done === 2 ) start();
});
});
@@ -1944,10 +1944,10 @@ test("jQuery.ajaxSetup({timeout: Number}) - with global timeout", function() {
jQuery("#qunit-fixture").ajaxError(pass);
jQuery.ajax({
- type: "GET",
- url: url("data/name.php?wait=5"),
- error: pass,
- success: fail
+ type: "GET",
+ url: url("data/name.php?wait=5"),
+ error: pass,
+ success: fail
});
// reset timeout
@@ -1959,17 +1959,17 @@ test("jQuery.ajaxSetup({timeout: Number}) with localtimeout", function() {
jQuery.ajaxSetup({timeout: 50});
jQuery.ajax({
- type: "GET",
- timeout: 15000,
- url: url("data/name.php?wait=1"),
- error: function() {
- ok( false, "Check for local timeout failed" );
- start();
- },
- success: function() {
- ok( true, "Check for local timeout" );
- start();
- }
+ type: "GET",
+ timeout: 15000,
+ url: url("data/name.php?wait=1"),
+ error: function() {
+ ok( false, "Check for local timeout failed" );
+ start();
+ },
+ success: function() {
+ ok( true, "Check for local timeout" );
+ start();
+ }
});
// reset timeout
@@ -1980,12 +1980,12 @@ test("jQuery.ajax - simple get", function() {
expect(1);
stop();
jQuery.ajax({
- type: "GET",
- url: url("data/name.php?name=foo"),
- success: function(msg){
- equal( msg, "bar", "Check for GET" );
- start();
- }
+ type: "GET",
+ url: url("data/name.php?name=foo"),
+ success: function(msg){
+ equal( msg, "bar", "Check for GET" );
+ start();
+ }
});
});
@@ -1993,13 +1993,13 @@ test("jQuery.ajax - simple post", function() {
expect(1);
stop();
jQuery.ajax({
- type: "POST",
- url: url("data/name.php"),
- data: "name=peter",
- success: function(msg){
- equal( msg, "pan", "Check for POST" );
- start();
- }
+ type: "POST",
+ url: url("data/name.php"),
+ data: "name=peter",
+ success: function(msg){
+ equal( msg, "pan", "Check for POST" );
+ start();
+ }
});
});
@@ -2091,7 +2091,7 @@ jQuery.each( { " (cache)": true, " (no cache)": false }, function( label, cache
ok(data == null, "response body should be empty");
}
start();
- },
+ },
error: function() {
// Do this because opera simply refuses to implement 304 handling :(
// A feature-driven way of detecting this would be appreciated
@@ -2140,8 +2140,8 @@ jQuery.each( { " (cache)": true, " (no cache)": false }, function( label, cache
ok(data == null, "response body should be empty");
}
start();
- },
- error: function() {
+ },
+ error: function() {
// Do this because opera simply refuses to implement 304 handling :(
// A feature-driven way of detecting this would be appreciated
// See: http://gist.github.com/599419
@@ -2476,7 +2476,7 @@ test( "jQuery.domManip - script in comments are properly evaluated (#11402)", fu
});
test("jQuery.ajax - active counter", function() {
- ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
+ ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
});
}
diff --git a/test/unit/core.js b/test/unit/core.js
index 94f985db6..4605795b4 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -1064,13 +1064,13 @@ test("jQuery.proxy", function(){
// Make sure it doesn't freak out
equal( jQuery.proxy( null, thisObject ), undefined, "Make sure no function was returned." );
- // Partial application
- var test2 = function( a ){ equal( a, "pre-applied", "Ensure arguments can be pre-applied." ); };
- jQuery.proxy( test2, null, "pre-applied" )();
+ // Partial application
+ var test2 = function( a ){ equal( a, "pre-applied", "Ensure arguments can be pre-applied." ); };
+ jQuery.proxy( test2, null, "pre-applied" )();
- // Partial application w/ normal arguments
- var test3 = function( a, b ){ equal( b, "normal", "Ensure arguments can be pre-applied and passed as usual." ); };
- jQuery.proxy( test3, null, "pre-applied" )( "normal" );
+ // Partial application w/ normal arguments
+ var test3 = function( a, b ){ equal( b, "normal", "Ensure arguments can be pre-applied and passed as usual." ); };
+ jQuery.proxy( test3, null, "pre-applied" )( "normal" );
// Test old syntax
var test4 = { meth: function( a ){ equal( a, "boom", "Ensure old syntax works." ); } };
@@ -1137,52 +1137,52 @@ test("jQuery.parseXML", 8, function(){
});
test("jQuery.sub() - Static Methods", function(){
- expect(18);
- var Subclass = jQuery.sub();
- Subclass.extend({
- topLevelMethod: function() {return this.debug;},
- debug: false,
- config: {
- locale: "en_US"
- },
- setup: function(config) {
- this.extend(true, this.config, config);
- }
- });
- Subclass.fn.extend({subClassMethod: function() { return this;}});
-
- //Test Simple Subclass
- ok(Subclass.topLevelMethod() === false, "Subclass.topLevelMethod thought debug was true");
- ok(Subclass.config.locale == "en_US", Subclass.config.locale + " is wrong!");
- deepEqual(Subclass.config.test, undefined, "Subclass.config.test is set incorrectly");
- equal(jQuery.ajax, Subclass.ajax, "The subclass failed to get all top level methods");
-
- //Create a SubSubclass
- var SubSubclass = Subclass.sub();
-
- //Make Sure the SubSubclass inherited properly
- ok(SubSubclass.topLevelMethod() === false, "SubSubclass.topLevelMethod thought debug was true");
- ok(SubSubclass.config.locale == "en_US", SubSubclass.config.locale + " is wrong!");
- deepEqual(SubSubclass.config.test, undefined, "SubSubclass.config.test is set incorrectly");
- equal(jQuery.ajax, SubSubclass.ajax, "The subsubclass failed to get all top level methods");
-
- //Modify The Subclass and test the Modifications
- SubSubclass.fn.extend({subSubClassMethod: function() { return this;}});
- SubSubclass.setup({locale: "es_MX", test: "worked"});
- SubSubclass.debug = true;
- SubSubclass.ajax = function() {return false;};
- ok(SubSubclass.topLevelMethod(), "SubSubclass.topLevelMethod thought debug was false");
- deepEqual(SubSubclass(document).subClassMethod, Subclass.fn.subClassMethod, "Methods Differ!");
- ok(SubSubclass.config.locale == "es_MX", SubSubclass.config.locale + " is wrong!");
- ok(SubSubclass.config.test == "worked", "SubSubclass.config.test is set incorrectly");
- notEqual(jQuery.ajax, SubSubclass.ajax, "The subsubclass failed to get all top level methods");
-
- //This shows that the modifications to the SubSubClass did not bubble back up to it's superclass
- ok(Subclass.topLevelMethod() === false, "Subclass.topLevelMethod thought debug was true");
- ok(Subclass.config.locale == "en_US", Subclass.config.locale + " is wrong!");
- deepEqual(Subclass.config.test, undefined, "Subclass.config.test is set incorrectly");
- deepEqual(Subclass(document).subSubClassMethod, undefined, "subSubClassMethod set incorrectly");
- equal(jQuery.ajax, Subclass.ajax, "The subclass failed to get all top level methods");
+ expect(18);
+ var Subclass = jQuery.sub();
+ Subclass.extend({
+ topLevelMethod: function() {return this.debug;},
+ debug: false,
+ config: {
+ locale: "en_US"
+ },
+ setup: function(config) {
+ this.extend(true, this.config, config);
+ }
+ });
+ Subclass.fn.extend({subClassMethod: function() { return this;}});
+
+ //Test Simple Subclass
+ ok(Subclass.topLevelMethod() === false, "Subclass.topLevelMethod thought debug was true");
+ ok(Subclass.config.locale == "en_US", Subclass.config.locale + " is wrong!");
+ deepEqual(Subclass.config.test, undefined, "Subclass.config.test is set incorrectly");
+ equal(jQuery.ajax, Subclass.ajax, "The subclass failed to get all top level methods");
+
+ //Create a SubSubclass
+ var SubSubclass = Subclass.sub();
+
+ //Make Sure the SubSubclass inherited properly
+ ok(SubSubclass.topLevelMethod() === false, "SubSubclass.topLevelMethod thought debug was true");
+ ok(SubSubclass.config.locale == "en_US", SubSubclass.config.locale + " is wrong!");
+ deepEqual(SubSubclass.config.test, undefined, "SubSubclass.config.test is set incorrectly");
+ equal(jQuery.ajax, SubSubclass.ajax, "The subsubclass failed to get all top level methods");
+
+ //Modify The Subclass and test the Modifications
+ SubSubclass.fn.extend({subSubClassMethod: function() { return this;}});
+ SubSubclass.setup({locale: "es_MX", test: "worked"});
+ SubSubclass.debug = true;
+ SubSubclass.ajax = function() {return false;};
+ ok(SubSubclass.topLevelMethod(), "SubSubclass.topLevelMethod thought debug was false");
+ deepEqual(SubSubclass(document).subClassMethod, Subclass.fn.subClassMethod, "Methods Differ!");
+ ok(SubSubclass.config.locale == "es_MX", SubSubclass.config.locale + " is wrong!");
+ ok(SubSubclass.config.test == "worked", "SubSubclass.config.test is set incorrectly");
+ notEqual(jQuery.ajax, SubSubclass.ajax, "The subsubclass failed to get all top level methods");
+
+ //This shows that the modifications to the SubSubClass did not bubble back up to it's superclass
+ ok(Subclass.topLevelMethod() === false, "Subclass.topLevelMethod thought debug was true");
+ ok(Subclass.config.locale == "en_US", Subclass.config.locale + " is wrong!");
+ deepEqual(Subclass.config.test, undefined, "Subclass.config.test is set incorrectly");
+ deepEqual(Subclass(document).subSubClassMethod, undefined, "subSubClassMethod set incorrectly");
+ equal(jQuery.ajax, Subclass.ajax, "The subclass failed to get all top level methods");
});
test("jQuery.sub() - .fn Methods", function(){