Commit de9bed31 authored by Chad Killingsworth's avatar Chad Killingsworth Committed by Dave Methvin

Make unit tests friendly to Closure Compiler. Closes gh-845.

    Conflicts:
    	test/unit/effects.js
    	test/unit/offset.js
parent 3dc77c4b
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"trailing": true, "trailing": true,
"undef": true, "undef": true,
"smarttabs": true, "smarttabs": true,
"maxerr": 100 "maxerr": 100,
"sub": true
}, },
"globals": { "globals": {
"define": true, "define": true,
......
This diff is collapsed.
...@@ -23,18 +23,18 @@ test("jQuery.propFix integrity test", function() { ...@@ -23,18 +23,18 @@ test("jQuery.propFix integrity test", function() {
// overwrites don't occur // overwrites don't occur
// This is simply for better code coverage and future proofing. // This is simply for better code coverage and future proofing.
var props = { var props = {
tabindex: "tabIndex", "tabindex": "tabIndex",
readonly: "readOnly", "readonly": "readOnly",
"for": "htmlFor", "for": "htmlFor",
"class": "className", "class": "className",
maxlength: "maxLength", "maxlength": "maxLength",
cellspacing: "cellSpacing", "cellspacing": "cellSpacing",
cellpadding: "cellPadding", "cellpadding": "cellPadding",
rowspan: "rowSpan", "rowspan": "rowSpan",
colspan: "colSpan", "colspan": "colSpan",
usemap: "useMap", "usemap": "useMap",
frameborder: "frameBorder", "frameborder": "frameBorder",
contenteditable: "contentEditable" "contenteditable": "contentEditable"
}; };
if ( !jQuery.support.enctype ) { if ( !jQuery.support.enctype ) {
...@@ -155,14 +155,14 @@ test("attr(String, Function)", function() { ...@@ -155,14 +155,14 @@ test("attr(String, Function)", function() {
test("attr(Hash)", function() { test("attr(Hash)", function() {
expect(3); expect(3);
var pass = true; var pass = true;
jQuery("div").attr({foo: "baz", zoo: "ping"}).each(function(){ jQuery("div").attr({"foo": "baz", "zoo": "ping"}).each(function(){
if ( this.getAttribute("foo") != "baz" && this.getAttribute("zoo") != "ping" ) { if ( this.getAttribute("foo") != "baz" && this.getAttribute("zoo") != "ping" ) {
pass = false; pass = false;
} }
}); });
ok( pass, "Set Multiple Attributes" ); ok( pass, "Set Multiple Attributes" );
equal( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" ); equal( jQuery("#text1").attr({"value": function() { return this["id"]; }})[0].value, "text1", "Set attribute to computed value #1" );
equal( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2"); equal( jQuery("#text1").attr({"title": function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2");
}); });
test("attr(String, Object)", function() { test("attr(String, Object)", function() {
...@@ -288,11 +288,11 @@ test("attr(String, Object)", function() { ...@@ -288,11 +288,11 @@ test("attr(String, Object)", function() {
var table = jQuery("#table").append("<tr><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr>"), var table = jQuery("#table").append("<tr><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr>"),
td = table.find("td:first"); td = table.find("td:first");
td.attr("rowspan", "2"); td.attr("rowspan", "2");
equal( td[0].rowSpan, 2, "Check rowspan is correctly set" ); equal( td[0]["rowSpan"], 2, "Check rowspan is correctly set" );
td.attr("colspan", "2"); td.attr("colspan", "2");
equal( td[0].colSpan, 2, "Check colspan is correctly set" ); equal( td[0]["colSpan"], 2, "Check colspan is correctly set" );
table.attr("cellspacing", "2"); table.attr("cellspacing", "2");
equal( table[0].cellSpacing, "2", "Check cellspacing is correctly set" ); equal( table[0]["cellSpacing"], "2", "Check cellspacing is correctly set" );
equal( jQuery("#area1").attr("value"), "foobar", "Value attribute retrieves the property for backwards compatibility." ); equal( jQuery("#area1").attr("value"), "foobar", "Value attribute retrieves the property for backwards compatibility." );
...@@ -381,26 +381,26 @@ test("attr(jquery_method)", function(){ ...@@ -381,26 +381,26 @@ test("attr(jquery_method)", function(){
if ( jQuery.fn.width ) { if ( jQuery.fn.width ) {
expected += 2; expected += 2;
attrObj.width = 10; attrObj["width"] = 10;
} }
if ( jQuery.fn.offset ) { if ( jQuery.fn.offset ) {
expected += 2; expected += 2;
attrObj.offset = { top: 1, left: 0 }; attrObj["offset"] = { "top": 1, "left": 0 };
} }
if ( jQuery.css ) { if ( jQuery.css ) {
expected += 3; expected += 3;
attrObj.css = { paddingLeft: 1, paddingRight: 1 }; attrObj["css"] = { "paddingLeft": 1, "paddingRight": 1 };
} }
expect( expected ); expect( expected );
// one at a time // one at a time
$elem.attr( { html: "foo" }, true ); $elem.attr( { "html": "foo" }, true );
equal( elem.innerHTML, "foo", "attr(html)" ); equal( elem.innerHTML, "foo", "attr(html)" );
$elem.attr( { text: "bar" }, true ); $elem.attr( { "text": "bar" }, true );
equal( elem.innerHTML, "bar", "attr(text)" ); equal( elem.innerHTML, "bar", "attr(text)" );
// Multiple attributes // Multiple attributes
...@@ -409,7 +409,7 @@ test("attr(jquery_method)", function(){ ...@@ -409,7 +409,7 @@ test("attr(jquery_method)", function(){
if ( jQuery.fn.width ) { if ( jQuery.fn.width ) {
equal( elem.style.width, "10px", "attr({width:})" ); equal( elem.style.width, "10px", "attr({width:})" );
$elem.attr( { height: 10 }, true ); $elem.attr( { "height": 10 }, true );
equal( elem.style.height, "10px", "attr(height)" ); equal( elem.style.height, "10px", "attr(height)" );
} }
...@@ -424,7 +424,7 @@ test("attr(jquery_method)", function(){ ...@@ -424,7 +424,7 @@ test("attr(jquery_method)", function(){
equal( elem.style.paddingLeft, "1px", "attr({css:})" ); equal( elem.style.paddingLeft, "1px", "attr({css:})" );
equal( elem.style.paddingRight, "1px", "attr({css:})" ); equal( elem.style.paddingRight, "1px", "attr({css:})" );
$elem.attr( { css: { color: "red" } }, true ); $elem.attr( { "css": { "color": "red" } }, true );
ok( /^(#ff0000|red)$/i.test( elem.style.color ), "attr(css)" ); ok( /^(#ff0000|red)$/i.test( elem.style.color ), "attr(css)" );
} }
}); });
...@@ -579,9 +579,9 @@ test("prop(String, Object)", function() { ...@@ -579,9 +579,9 @@ test("prop(String, Object)", function() {
$body = jQuery( body ); $body = jQuery( body );
ok( $body.prop("nextSibling") === null, "Make sure a null expando returns null" ); ok( $body.prop("nextSibling") === null, "Make sure a null expando returns null" );
body.foo = "bar"; body["foo"] = "bar";
equal( $body.prop("foo"), "bar", "Make sure the expando is preferred over the dom attribute" ); equal( $body.prop("foo"), "bar", "Make sure the expando is preferred over the dom attribute" );
body.foo = undefined; body["foo"] = undefined;
ok( $body.prop("foo") === undefined, "Make sure the expando is preferred over the dom attribute, even if undefined" ); ok( $body.prop("foo") === undefined, "Make sure the expando is preferred over the dom attribute, even if undefined" );
var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option"); var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option");
...@@ -673,17 +673,17 @@ test("removeProp(String)", function() { ...@@ -673,17 +673,17 @@ test("removeProp(String)", function() {
textNode = document.createTextNode("some text"), textNode = document.createTextNode("some text"),
obj = {}; obj = {};
strictEqual( jQuery( "#firstp" ).prop( "nonexisting", "foo" ).removeProp( "nonexisting" )[0].nonexisting, undefined, "removeprop works correctly on DOM element nodes" ); strictEqual( jQuery( "#firstp" ).prop( "nonexisting", "foo" ).removeProp( "nonexisting" )[0]["nonexisting"], undefined, "removeprop works correctly on DOM element nodes" );
jQuery.each( [document, obj], function( i, ele ) { jQuery.each( [document, obj], function( i, ele ) {
var $ele = jQuery( ele ); var $ele = jQuery( ele );
$ele.prop( "nonexisting", "foo" ).removeProp( "nonexisting" ); $ele.prop( "nonexisting", "foo" ).removeProp( "nonexisting" );
strictEqual( ele.nonexisting, undefined, "removeProp works correctly on non DOM element nodes (bug #7500)." ); strictEqual( ele["nonexisting"], undefined, "removeProp works correctly on non DOM element nodes (bug #7500)." );
}); });
jQuery.each( [commentNode, textNode, attributeNode], function( i, ele ) { jQuery.each( [commentNode, textNode, attributeNode], function( i, ele ) {
var $ele = jQuery( ele ); var $ele = jQuery( ele );
$ele.prop( "nonexisting", "foo" ).removeProp( "nonexisting" ); $ele.prop( "nonexisting", "foo" ).removeProp( "nonexisting" );
strictEqual( ele.nonexisting, undefined, "removeProp works correctly on non DOM element nodes (bug #7500)." ); strictEqual( ele["nonexisting"], undefined, "removeProp works correctly on non DOM element nodes (bug #7500)." );
}); });
}); });
...@@ -898,7 +898,7 @@ test("val(select) after form.reset() (Bug #2551)", function() { ...@@ -898,7 +898,7 @@ test("val(select) after form.reset() (Bug #2551)", function() {
jQuery("#kkk").val( "gf" ); jQuery("#kkk").val( "gf" );
document.kk.reset(); document["kk"].reset();
equal( jQuery("#kkk")[0].value, "cf", "Check value of select after form reset." ); equal( jQuery("#kkk")[0].value, "cf", "Check value of select after form reset." );
equal( jQuery("#kkk").val(), "cf", "Check value of select after form reset." ); equal( jQuery("#kkk").val(), "cf", "Check value of select after form reset." );
......
...@@ -209,14 +209,14 @@ test( "jQuery.Callbacks( options ) - options are copied", function() { ...@@ -209,14 +209,14 @@ test( "jQuery.Callbacks( options ) - options are copied", function() {
expect( 1 ); expect( 1 );
var options = { var options = {
unique: true "unique": true
}, },
cb = jQuery.Callbacks( options ), cb = jQuery.Callbacks( options ),
count = 0, count = 0,
fn = function() { fn = function() {
ok( !( count++ ), "called once" ); ok( !( count++ ), "called once" );
}; };
options.unique = false; options["unique"] = false;
cb.add( fn, fn ); cb.add( fn, fn );
cb.fire(); cb.fire();
}); });
......
This diff is collapsed.
...@@ -10,11 +10,11 @@ test("css(String|Hash)", function() { ...@@ -10,11 +10,11 @@ test("css(String|Hash)", function() {
ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible" ); ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible" );
jQuery("#nothiddendiv").css({ display: "none" }); jQuery("#nothiddendiv").css({ display: "none" });
ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden" ); ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden" );
var $child = jQuery("#nothiddendivchild").css({ width: "20%", height: "20%" }); var $child = jQuery("#nothiddendivchild").css({ "width": "20%", "height": "20%" });
notEqual( $child.css("width"), "20px", "Retrieving a width percentage on the child of a hidden div returns percentage" ); notEqual( $child.css("width"), "20px", "Retrieving a width percentage on the child of a hidden div returns percentage" );
notEqual( $child.css("height"), "20px", "Retrieving a height percentage on the child of a hidden div returns percentage" ); notEqual( $child.css("height"), "20px", "Retrieving a height percentage on the child of a hidden div returns percentage" );
jQuery("#nothiddendiv").css({display: "block"}); jQuery("#nothiddendiv").css({"display": "block"});
ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible"); ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible");
ok( jQuery(window).is(":visible"), "Calling is(':visible') on window does not throw an error in IE."); ok( jQuery(window).is(":visible"), "Calling is(':visible') on window does not throw an error in IE.");
ok( jQuery(document).is(":visible"), "Calling is(':visible') on document does not throw an error in IE."); ok( jQuery(document).is(":visible"), "Calling is(':visible') on document does not throw an error in IE.");
...@@ -26,7 +26,7 @@ test("css(String|Hash)", function() { ...@@ -26,7 +26,7 @@ test("css(String|Hash)", function() {
equal( div.css("width"), "0px", "Width on disconnected node." ); equal( div.css("width"), "0px", "Width on disconnected node." );
equal( div.css("height"), "0px", "Height on disconnected node." ); equal( div.css("height"), "0px", "Height on disconnected node." );
div.css({ width: 4, height: 4 }); div.css({ "width": 4, "height": 4 });
equal( div.css("width"), "4px", "Width on disconnected node." ); equal( div.css("width"), "4px", "Width on disconnected node." );
equal( div.css("height"), "4px", "Height on disconnected node." ); equal( div.css("height"), "4px", "Height on disconnected node." );
...@@ -40,10 +40,10 @@ test("css(String|Hash)", function() { ...@@ -40,10 +40,10 @@ test("css(String|Hash)", function() {
div2.remove(); div2.remove();
// handle negative numbers by setting to zero #11604 // handle negative numbers by setting to zero #11604
jQuery("#nothiddendiv").css( {width: 1, height: 1} ); jQuery("#nothiddendiv").css( {"width": 1, "height": 1} );
var width = parseFloat(jQuery("#nothiddendiv").css("width")), height = parseFloat(jQuery("#nothiddendiv").css("height")); var width = parseFloat(jQuery("#nothiddendiv").css("width")), height = parseFloat(jQuery("#nothiddendiv").css("height"));
jQuery("#nothiddendiv").css({ overflow:"hidden", width: -1, height: -1 }); jQuery("#nothiddendiv").css({ "overflow":"hidden", "width": -1, "height": -1 });
equal( parseFloat(jQuery("#nothiddendiv").css("width")), 0, "Test negative width set to 0"); equal( parseFloat(jQuery("#nothiddendiv").css("width")), 0, "Test negative width set to 0");
equal( parseFloat(jQuery("#nothiddendiv").css("height")), 0, "Test negative height set to 0"); equal( parseFloat(jQuery("#nothiddendiv").css("height")), 0, "Test negative height set to 0");
...@@ -54,17 +54,17 @@ test("css(String|Hash)", function() { ...@@ -54,17 +54,17 @@ test("css(String|Hash)", function() {
jQuery("#floatTest").css({"font-size": "30px"}); jQuery("#floatTest").css({"font-size": "30px"});
equal( jQuery("#floatTest").css("font-size"), "30px", "Modified CSS font-size: Assert font-size is 30px"); equal( jQuery("#floatTest").css("font-size"), "30px", "Modified CSS font-size: Assert font-size is 30px");
jQuery.each("0,0.25,0.5,0.75,1".split(","), function(i, n) { jQuery.each("0,0.25,0.5,0.75,1".split(","), function(i, n) {
jQuery("#foo").css({opacity: n}); jQuery("#foo").css({"opacity": n});
equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" ); equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
jQuery("#foo").css({opacity: parseFloat(n)}); jQuery("#foo").css({"opacity": parseFloat(n)});
equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" ); equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
}); });
jQuery("#foo").css({opacity: ""}); jQuery("#foo").css({"opacity": ""});
equal( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when set to an empty String" ); equal( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when set to an empty String" );
equal( jQuery("#empty").css("opacity"), "0", "Assert opacity is accessible via filter property set in stylesheet in IE" ); equal( jQuery("#empty").css("opacity"), "0", "Assert opacity is accessible via filter property set in stylesheet in IE" );
jQuery("#empty").css({ opacity: "1" }); jQuery("#empty").css({ "opacity": "1" });
equal( jQuery("#empty").css("opacity"), "1", "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ); equal( jQuery("#empty").css("opacity"), "1", "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
jQuery.support.opacity ? jQuery.support.opacity ?
ok(true, "Requires the same number of tests"): ok(true, "Requires the same number of tests"):
...@@ -121,7 +121,7 @@ test("css() explicit and relative values", function() { ...@@ -121,7 +121,7 @@ test("css() explicit and relative values", function() {
expect(29); expect(29);
var $elem = jQuery("#nothiddendiv"); var $elem = jQuery("#nothiddendiv");
$elem.css({ width: 1, height: 1, paddingLeft: "1px", opacity: 1 }); $elem.css({ "width": 1, "height": 1, "paddingLeft": "1px", "opacity": 1 });
equal( $elem.css("width"), "1px", "Initial css set or width/height works (hash)" ); equal( $elem.css("width"), "1px", "Initial css set or width/height works (hash)" );
equal( $elem.css("paddingLeft"), "1px", "Initial css set of paddingLeft works (hash)" ); equal( $elem.css("paddingLeft"), "1px", "Initial css set of paddingLeft works (hash)" );
equal( $elem.css("opacity"), "1", "Initial css set of opacity works (hash)" ); equal( $elem.css("opacity"), "1", "Initial css set of opacity works (hash)" );
...@@ -129,13 +129,13 @@ test("css() explicit and relative values", function() { ...@@ -129,13 +129,13 @@ test("css() explicit and relative values", function() {
$elem.css({ width: "+=9" }); $elem.css({ width: "+=9" });
equal( $elem.css("width"), "10px", "'+=9' on width (hash)" ); equal( $elem.css("width"), "10px", "'+=9' on width (hash)" );
$elem.css({ width: "-=9" }); $elem.css({ "width": "-=9" });
equal( $elem.css("width"), "1px", "'-=9' on width (hash)" ); equal( $elem.css("width"), "1px", "'-=9' on width (hash)" );
$elem.css({ width: "+=9px" }); $elem.css({ "width": "+=9px" });
equal( $elem.css("width"), "10px", "'+=9px' on width (hash)" ); equal( $elem.css("width"), "10px", "'+=9px' on width (hash)" );
$elem.css({ width: "-=9px" }); $elem.css({ "width": "-=9px" });
equal( $elem.css("width"), "1px", "'-=9px' on width (hash)" ); equal( $elem.css("width"), "1px", "'-=9px' on width (hash)" );
$elem.css( "width", "+=9" ); $elem.css( "width", "+=9" );
...@@ -156,16 +156,16 @@ test("css() explicit and relative values", function() { ...@@ -156,16 +156,16 @@ test("css() explicit and relative values", function() {
$elem.css( "width", "+=-9px" ); $elem.css( "width", "+=-9px" );
equal( $elem.css("width"), "1px", "'+=-9px' on width (params)" ); equal( $elem.css("width"), "1px", "'+=-9px' on width (params)" );
$elem.css({ paddingLeft: "+=4" }); $elem.css({ "paddingLeft": "+=4" });
equal( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (hash)" ); equal( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (hash)" );
$elem.css({ paddingLeft: "-=4" }); $elem.css({ "paddingLeft": "-=4" });
equal( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (hash)" ); equal( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (hash)" );
$elem.css({ paddingLeft: "+=4px" }); $elem.css({ "paddingLeft": "+=4px" });
equal( $elem.css("paddingLeft"), "5px", "'+=4px' on paddingLeft (hash)" ); equal( $elem.css("paddingLeft"), "5px", "'+=4px' on paddingLeft (hash)" );
$elem.css({ paddingLeft: "-=4px" }); $elem.css({ "paddingLeft": "-=4px" });
equal( $elem.css("paddingLeft"), "1px", "'-=4px' on paddingLeft (hash)" ); equal( $elem.css("paddingLeft"), "1px", "'-=4px' on paddingLeft (hash)" );
$elem.css({ "padding-left": "+=4" }); $elem.css({ "padding-left": "+=4" });
...@@ -192,10 +192,10 @@ test("css() explicit and relative values", function() { ...@@ -192,10 +192,10 @@ test("css() explicit and relative values", function() {
$elem.css( "padding-left", "-=4px" ); $elem.css( "padding-left", "-=4px" );
equal( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (params)" ); equal( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (params)" );
$elem.css({ opacity: "-=0.5" }); $elem.css({ "opacity": "-=0.5" });
equal( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (hash)" ); equal( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (hash)" );
$elem.css({ opacity: "+=0.5" }); $elem.css({ "opacity": "+=0.5" });
equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (hash)" ); equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (hash)" );
$elem.css( "opacity", "-=0.5" ); $elem.css( "opacity", "-=0.5" );
...@@ -365,7 +365,7 @@ test("css(Object) where values are Functions", function() { ...@@ -365,7 +365,7 @@ test("css(Object) where values are Functions", function() {
var index = 0; var index = 0;
jQuery("#cssFunctionTest div").css({fontSize: function() { jQuery("#cssFunctionTest div").css({"fontSize": function() {
var size = sizes[index]; var size = sizes[index];
index++; index++;
return size; return size;
...@@ -395,7 +395,7 @@ test("css(Object) where values are Functions with incoming values", function() { ...@@ -395,7 +395,7 @@ test("css(Object) where values are Functions with incoming values", function() {
var index = 0; var index = 0;
jQuery("#cssFunctionTest div").css({fontSize: function() { jQuery("#cssFunctionTest div").css({"fontSize": function() {
var size = sizes[index]; var size = sizes[index];
index++; index++;
return size; return size;
...@@ -486,7 +486,7 @@ test("show(); hide()", function() { ...@@ -486,7 +486,7 @@ test("show(); hide()", function() {
test("show() resolves correct default display #8099", function() { test("show() resolves correct default display #8099", function() {
expect(7); expect(7);
var tt8099 = jQuery("<tt/>").appendTo("body"), var tt8099 = jQuery("<tt/>").appendTo("body"),
dfn8099 = jQuery("<dfn/>", { html: "foo"}).appendTo("body"); dfn8099 = jQuery("<dfn/>", { "html": "foo"}).appendTo("body");
equal( tt8099.css("display"), "none", "default display override for all tt" ); equal( tt8099.css("display"), "none", "default display override for all tt" );
equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" ); equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" );
...@@ -621,7 +621,7 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () { ...@@ -621,7 +621,7 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () {
var result = true; var result = true;
try { try {
jQuery("#foo").css( { width: "0%" } ).css("width"); jQuery("#foo").css( { "width": "0%" } ).css("width");
} catch (e) { } catch (e) {
result = false; result = false;
} }
...@@ -634,8 +634,8 @@ test("marginRight computed style (bug #3333)", function() { ...@@ -634,8 +634,8 @@ test("marginRight computed style (bug #3333)", function() {
var $div = jQuery("#foo"); var $div = jQuery("#foo");
$div.css({ $div.css({
width: "1px", "width": "1px",
marginRight: 0 "marginRight": 0
}); });
equal($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block"); equal($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block");
...@@ -643,9 +643,9 @@ test("marginRight computed style (bug #3333)", function() { ...@@ -643,9 +643,9 @@ test("marginRight computed style (bug #3333)", function() {
test("jQuery.cssProps behavior, (bug #8402)", function() { test("jQuery.cssProps behavior, (bug #8402)", function() {
var div = jQuery( "<div>" ).appendTo(document.body).css({ var div = jQuery( "<div>" ).appendTo(document.body).css({
position: "absolute", "position": "absolute",
top: 0, "top": 0,
left: 10 "left": 10
}); });
jQuery.cssProps.top = "left"; jQuery.cssProps.top = "left";
equal( div.css("top"), "10px", "the fixed property is used when accessing the computed style"); equal( div.css("top"), "10px", "the fixed property is used when accessing the computed style");
...@@ -662,16 +662,16 @@ test("widows & orphans #8936", function () { ...@@ -662,16 +662,16 @@ test("widows & orphans #8936", function () {
if ( "widows" in $p[0].style ) { if ( "widows" in $p[0].style ) {
expect(4); expect(4);
$p.css({ $p.css({
widows: 0, "widows": 0,
orphans: 0 "orphans": 0
}); });
equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0"); equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0");
equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0"); equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0");
$p.css({ $p.css({
widows: 3, "widows": 3,
orphans: 3 "orphans": 3
}); });
equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3"); equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3");
......
...@@ -3,7 +3,7 @@ module("data", { teardown: moduleTeardown }); ...@@ -3,7 +3,7 @@ module("data", { teardown: moduleTeardown });
test("expando", function(){ test("expando", function(){
expect(1); expect(1);
equal("expando" in jQuery, true, "jQuery is exposing the expando"); equal(jQuery.expando !== undefined, true, "jQuery is exposing the expando");
}); });
function dataTests (elem) { function dataTests (elem) {
...@@ -29,14 +29,14 @@ function dataTests (elem) { ...@@ -29,14 +29,14 @@ function dataTests (elem) {
strictEqual( jQuery.hasData(elem), false, "jQuery.hasData agrees no data exists even when an empty data obj exists" ); strictEqual( jQuery.hasData(elem), false, "jQuery.hasData agrees no data exists even when an empty data obj exists" );
dataObj.foo = "bar"; dataObj["foo"] = "bar";
equal( jQuery.data(elem, "foo"), "bar", "Data is readable by jQuery.data when set directly on a returned data object" ); equal( jQuery.data(elem, "foo"), "bar", "Data is readable by jQuery.data when set directly on a returned data object" );
strictEqual( jQuery.hasData(elem), true, "jQuery.hasData agrees data exists when data exists" ); strictEqual( jQuery.hasData(elem), true, "jQuery.hasData agrees data exists when data exists" );
jQuery.data(elem, "foo", "baz"); jQuery.data(elem, "foo", "baz");
equal( jQuery.data(elem, "foo"), "baz", "Data can be changed by jQuery.data" ); equal( jQuery.data(elem, "foo"), "baz", "Data can be changed by jQuery.data" );
equal( dataObj.foo, "baz", "Changes made through jQuery.data propagate to referenced data object" ); equal( dataObj["foo"], "baz", "Changes made through jQuery.data propagate to referenced data object" );
jQuery.data(elem, "foo", undefined); jQuery.data(elem, "foo", undefined);
equal( jQuery.data(elem, "foo"), "baz", "Data is not unset by passing undefined to jQuery.data" ); equal( jQuery.data(elem, "foo"), "baz", "Data is not unset by passing undefined to jQuery.data" );
...@@ -197,7 +197,7 @@ test(".data()", function() { ...@@ -197,7 +197,7 @@ test(".data()", function() {
dataObj = jQuery.extend(true, {}, jQuery(obj).data()); dataObj = jQuery.extend(true, {}, jQuery(obj).data());
deepEqual( dataObj, { foo: "baz" }, "Retrieve data object from a wrapped JS object (#7524)" ); deepEqual( dataObj, { "foo": "baz" }, "Retrieve data object from a wrapped JS object (#7524)" );
}); });
test(".data(String) and .data(String, Object)", function() { test(".data(String) and .data(String, Object)", function() {
...@@ -428,8 +428,8 @@ test(".data(Object)", function() { ...@@ -428,8 +428,8 @@ test(".data(Object)", function() {
jqobj = jQuery(obj); jqobj = jQuery(obj);
jqobj.data("test", "unset"); jqobj.data("test", "unset");
jqobj.data({ "test": "in", "test2": "in2" }); jqobj.data({ "test": "in", "test2": "in2" });
equal( jQuery.data(obj).test, "in", "Verify setting an object on an object extends the data object" ); equal( jQuery.data(obj)["test"], "in", "Verify setting an object on an object extends the data object" );
equal( obj.test2, undefined, "Verify setting an object on an object does not extend the object" ); equal( obj["test2"], undefined, "Verify setting an object on an object does not extend the object" );
// manually clean up detached elements // manually clean up detached elements
div.remove(); div.remove();
...@@ -463,7 +463,7 @@ test("jQuery.removeData", function() { ...@@ -463,7 +463,7 @@ test("jQuery.removeData", function() {
jQuery.data(div, { jQuery.data(div, {
"test3 test4": "testing", "test3 test4": "testing",
test3: "testing" "test3": "testing"
}); });
jQuery.removeData( div, "test3 test4" ); jQuery.removeData( div, "test3 test4" );
ok( !jQuery.data(div, "test3 test4"), "Multiple delete with spaces deleted key with exact name" ); ok( !jQuery.data(div, "test3 test4"), "Multiple delete with spaces deleted key with exact name" );
...@@ -505,7 +505,7 @@ if (window.JSON && window.JSON.stringify) { ...@@ -505,7 +505,7 @@ if (window.JSON && window.JSON.stringify) {
test("JSON serialization (#8108)", function () { test("JSON serialization (#8108)", function () {
expect(1); expect(1);
var obj = { foo: "bar" }; var obj = { "foo": "bar" };
jQuery.data(obj, "hidden", true); jQuery.data(obj, "hidden", true);
equal( JSON.stringify(obj), "{\"foo\":\"bar\"}", "Expando is hidden from JSON.stringify" ); equal( JSON.stringify(obj), "{\"foo\":\"bar\"}", "Expando is hidden from JSON.stringify" );
...@@ -518,12 +518,12 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun ...@@ -518,12 +518,12 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun
var div = jQuery("<div id='myObject' data-w-t-f='ftw' data-big-a-little-a='bouncing-b' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>") var div = jQuery("<div id='myObject' data-w-t-f='ftw' data-big-a-little-a='bouncing-b' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>")
.prependTo("body"); .prependTo("body");
equal( div.data().wTF, "ftw", "Verify single letter data-* key" ); equal( div.data()["wTF"], "ftw", "Verify single letter data-* key" );
equal( div.data().bigALittleA, "bouncing-b", "Verify single letter mixed data-* key" ); equal( div.data()["bigALittleA"], "bouncing-b", "Verify single letter mixed data-* key" );
equal( div.data().foo, "a", "Verify single word data-* key" ); equal( div.data()["foo"], "a", "Verify single word data-* key" );
equal( div.data().fooBar, "b", "Verify multiple word data-* key" ); equal( div.data()["fooBar"], "b", "Verify multiple word data-* key" );
equal( div.data().fooBarBaz, "c", "Verify multiple word data-* key" ); equal( div.data()["fooBarBaz"], "c", "Verify multiple word data-* key" );
equal( div.data("foo"), "a", "Verify single word data-* key" ); equal( div.data("foo"), "a", "Verify single word data-* key" );
equal( div.data("fooBar"), "b", "Verify multiple word data-* key" ); equal( div.data("fooBar"), "b", "Verify multiple word data-* key" );
...@@ -627,8 +627,8 @@ test("Triggering the removeData should not throw exceptions. (#10080)", function ...@@ -627,8 +627,8 @@ test("Triggering the removeData should not throw exceptions. (#10080)", function
test( "Only check element attributes once when calling .data() - #8909", function() { test( "Only check element attributes once when calling .data() - #8909", function() {
expect( 2 ); expect( 2 );
var testing = { var testing = {
test: "testing", "test": "testing",
test2: "testing" "test2": "testing"
}, },
element = jQuery( "<div data-test='testing'>" ), element = jQuery( "<div data-test='testing'>" ),
node = element[ 0 ]; node = element[ 0 ];
......
...@@ -39,7 +39,8 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) { ...@@ -39,7 +39,8 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
strictEqual( value , "done" , "Passed function executed" ); strictEqual( value , "done" , "Passed function executed" );
}); });
jQuery.each( "resolve reject".split( " " ), function( _, change ) { jQuery.expandedEach = jQuery.each;
jQuery.expandedEach( "resolve reject".split( " " ), function( _, change ) {
createDeferred( function( defer ) { createDeferred( function( defer ) {
strictEqual( defer.state(), "pending", "pending after creation" ); strictEqual( defer.state(), "pending", "pending after creation" );
var checked = 0; var checked = 0;
...@@ -60,12 +61,12 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) { ...@@ -60,12 +61,12 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
test( "jQuery.Deferred - chainability", function() { test( "jQuery.Deferred - chainability", function() {
var methods = "resolve reject notify resolveWith rejectWith notifyWith done fail progress always".split( " " ), var defer = jQuery.Deferred();
defer = jQuery.Deferred();
expect( methods.length ); expect( 10 );
jQuery.each( methods, function( _, method ) { jQuery.expandedEach = jQuery.each;
jQuery.expandedEach( "resolve reject notify resolveWith rejectWith notifyWith done fail progress always".split( " " ), function( _, method ) {
var object = { m: defer[ method ] }; var object = { m: defer[ method ] };
strictEqual( object.m(), object, method + " is chainable" ); strictEqual( object.m(), object, method + " is chainable" );
}); });
......
...@@ -38,11 +38,11 @@ var testWidth = function( val ) { ...@@ -38,11 +38,11 @@ var testWidth = function( val ) {
$div.css("border", "2px solid #fff"); $div.css("border", "2px solid #fff");
equal($div.width(), 0, "Test border specified with pixels"); equal($div.width(), 0, "Test border specified with pixels");
$div.css({ display: "", border: "", padding: "" }); $div.css({ "display": "", "border": "", "padding": "" });
jQuery("#nothiddendivchild").css({ width: 20, padding: "3px", border: "2px solid #fff" }); jQuery("#nothiddendivchild").css({ "width": 20, "padding": "3px", "border": "2px solid #fff" });
equal(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding"); equal(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding");
jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" }); jQuery("#nothiddendiv, #nothiddendivchild").css({ "border": "", "padding": "", "width": "" });
var blah = jQuery("blah"); var blah = jQuery("blah");
equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." ); equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
...@@ -89,11 +89,11 @@ var testHeight = function( val ) { ...@@ -89,11 +89,11 @@ var testHeight = function( val ) {
$div.css("border", "2px solid #fff"); $div.css("border", "2px solid #fff");
equal($div.height(), 0, "Test border specified with pixels"); equal($div.height(), 0, "Test border specified with pixels");
$div.css({ display: "", border: "", padding: "", height: "1px" }); $div.css({ "display": "", "border": "", "padding": "", "height": "1px" });
jQuery("#nothiddendivchild").css({ height: 20, padding: "3px", border: "2px solid #fff" }); jQuery("#nothiddendivchild").css({ "height": 20, "padding": "3px", "border": "2px solid #fff" });
equal(jQuery("#nothiddendivchild").height(), 20, "Test child height with border and padding"); equal(jQuery("#nothiddendivchild").height(), 20, "Test child height with border and padding");
jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", height: "" }); jQuery("#nothiddendiv, #nothiddendivchild").css({ "border": "", "padding": "", "height": "" });
var blah = jQuery("blah"); var blah = jQuery("blah");
equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." ); equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
...@@ -136,9 +136,9 @@ test("innerWidth()", function() { ...@@ -136,9 +136,9 @@ test("innerWidth()", function() {
var $div = jQuery("#nothiddendiv"); var $div = jQuery("#nothiddendiv");
// set styles // set styles
$div.css({ $div.css({
margin: 10, "margin": 10,
border: "2px solid #fff", "border": "2px solid #fff",
width: 30 "width": 30
}); });
equal($div.innerWidth(), 30, "Test with margin and border"); equal($div.innerWidth(), 30, "Test with margin and border");
...@@ -148,7 +148,7 @@ test("innerWidth()", function() { ...@@ -148,7 +148,7 @@ test("innerWidth()", function() {
equal($div.innerWidth(), 70, "Test hidden div"); equal($div.innerWidth(), 70, "Test hidden div");
// reset styles // reset styles
$div.css({ display: "", border: "", padding: "", width: "", height: "" }); $div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" ); var div = jQuery( "<div>" );
...@@ -171,9 +171,9 @@ test("innerHeight()", function() { ...@@ -171,9 +171,9 @@ test("innerHeight()", function() {
var $div = jQuery("#nothiddendiv"); var $div = jQuery("#nothiddendiv");
// set styles // set styles
$div.css({ $div.css({
margin: 10, "margin": 10,
border: "2px solid #fff", "border": "2px solid #fff",
height: 30 "height": 30
}); });
equal($div.innerHeight(), 30, "Test with margin and border"); equal($div.innerHeight(), 30, "Test with margin and border");
...@@ -183,7 +183,7 @@ test("innerHeight()", function() { ...@@ -183,7 +183,7 @@ test("innerHeight()", function() {
equal($div.innerHeight(), 70, "Test hidden div"); equal($div.innerHeight(), 70, "Test hidden div");
// reset styles // reset styles
$div.css({ display: "", border: "", padding: "", width: "", height: "" }); $div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" ); var div = jQuery( "<div>" );
...@@ -221,7 +221,7 @@ test("outerWidth()", function() { ...@@ -221,7 +221,7 @@ test("outerWidth()", function() {
equal($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option"); equal($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
// reset styles // reset styles
$div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" }); $div.css({ "position": "", "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" ); var div = jQuery( "<div>" );
...@@ -236,7 +236,7 @@ test("child of a hidden elem (or unconnected node) has accurate inner/outer/Widt ...@@ -236,7 +236,7 @@ test("child of a hidden elem (or unconnected node) has accurate inner/outer/Widt
expect(16); expect(16);
// setup html // setup html
var $divNormal = jQuery("<div>").css({ width: "100px", height: "100px", border: "10px solid white", padding: "2px", margin: "3px" }), var $divNormal = jQuery("<div>").css({ "width": "100px", "height": "100px", "border": "10px solid white", "padding": "2px", "margin": "3px" }),
$divChild = $divNormal.clone(), $divChild = $divNormal.clone(),
$divUnconnected = $divNormal.clone(), $divUnconnected = $divNormal.clone(),
$divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body"); $divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
...@@ -294,7 +294,7 @@ test("getting dimensions shouldnt modify runtimeStyle see #9233", function() { ...@@ -294,7 +294,7 @@ test("getting dimensions shouldnt modify runtimeStyle see #9233", function() {
test("outerWidth(true) returning % instead of px in Webkit, see #10639", function() { test("outerWidth(true) returning % instead of px in Webkit, see #10639", function() {
var container = jQuery( "<div/>" ).width(400).appendTo( "#qunit-fixture" ), var container = jQuery( "<div/>" ).width(400).appendTo( "#qunit-fixture" ),
el = jQuery( "<div/>" ).css({ width: "50%", marginRight: "50%" }).appendTo( container ); el = jQuery( "<div/>" ).css({ "width": "50%", "marginRight": "50%" }).appendTo( container );
equal( el.outerWidth(true), 400, "outerWidth(true) and css('margin') returning % instead of px in Webkit, see #10639" ); equal( el.outerWidth(true), 400, "outerWidth(true) and css('margin') returning % instead of px in Webkit, see #10639" );
}); });
...@@ -305,7 +305,7 @@ test( "getting dimensions of zero width/height table elements shouldn't alter di ...@@ -305,7 +305,7 @@ test( "getting dimensions of zero width/height table elements shouldn't alter di
var table = jQuery("<table><tbody><tr><td></td><td>a</td></tr><tr><td></td><td>a</td></tr></tbody></table>").appendTo("#qunit-fixture"), var table = jQuery("<table><tbody><tr><td></td><td>a</td></tr><tr><td></td><td>a</td></tr></tbody></table>").appendTo("#qunit-fixture"),
elem = table.find("tr:eq(0) td:eq(0)"); elem = table.find("tr:eq(0) td:eq(0)");
table.find("td").css({ margin: 0, padding: 0 }); table.find("td").css({ "margin": 0, "padding": 0 });
equal( elem.width(), elem.width(), "width() doesn't alter dimension values" ); equal( elem.width(), elem.width(), "width() doesn't alter dimension values" );
}); });
...@@ -313,7 +313,7 @@ test("box-sizing:border-box child of a hidden elem (or unconnected node) has acc ...@@ -313,7 +313,7 @@ test("box-sizing:border-box child of a hidden elem (or unconnected node) has acc
expect(16); expect(16);
// setup html // setup html
var $divNormal = jQuery("<div>").css({ boxSizing: "border-box", width: "100px", height: "100px", border: "10px solid white", padding: "2px", margin: "3px" }), var $divNormal = jQuery("<div>").css({ "boxSizing": "border-box", "width": "100px", "height": "100px", "border": "10px solid white", "padding": "2px", "margin": "3px" }),
$divChild = $divNormal.clone(), $divChild = $divNormal.clone(),
$divUnconnected = $divNormal.clone(), $divUnconnected = $divNormal.clone(),
$divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body"); $divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
...@@ -373,7 +373,7 @@ test("outerHeight()", function() { ...@@ -373,7 +373,7 @@ test("outerHeight()", function() {
equal($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option"); equal($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
// reset styles // reset styles
$div.css({ display: "", border: "", padding: "", width: "", height: "" }); $div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" ); var div = jQuery( "<div>" );
......
...@@ -199,7 +199,7 @@ test("animate negative height", function() { ...@@ -199,7 +199,7 @@ test("animate negative height", function() {
test("animate negative margin", function() { test("animate negative margin", function() {
expect(1); expect(1);
stop(); stop();
jQuery("#foo").animate({ marginTop: -100 }, 100, function() { jQuery("#foo").animate({ "marginTop": -100 }, 100, function() {
equal( jQuery(this).css("marginTop"), "-100px", "Verify margin." ); equal( jQuery(this).css("marginTop"), "-100px", "Verify margin." );
start(); start();
}); });
...@@ -217,7 +217,7 @@ test("animate negative margin with px", function() { ...@@ -217,7 +217,7 @@ test("animate negative margin with px", function() {
test("animate negative padding", function() { test("animate negative padding", function() {
expect(1); expect(1);
stop(); stop();
jQuery("#foo").animate({ paddingBottom: -100 }, 100, function() { jQuery("#foo").animate({ "paddingBottom": -100 }, 100, function() {
equal( jQuery(this).css("paddingBottom"), "0px", "Verify paddingBottom." ); equal( jQuery(this).css("paddingBottom"), "0px", "Verify paddingBottom." );
start(); start();
}); });
...@@ -559,7 +559,7 @@ test("stop()", function() { ...@@ -559,7 +559,7 @@ test("stop()", function() {
var w = 0; var w = 0;
$foo.hide().css( "width", 200 ) $foo.hide().css( "width", 200 )
.animate( { width: "show" }, 1000 ); .animate( { "width": "show" }, 1000 );
setTimeout(function() { setTimeout(function() {
var nw = $foo.css("width"); var nw = $foo.css("width");
...@@ -598,9 +598,9 @@ test("stop() - several in queue", function() { ...@@ -598,9 +598,9 @@ test("stop() - several in queue", function() {
var w = 0; var w = 0;
$foo.hide().css( "width", 200 ).css("width"); $foo.hide().css( "width", 200 ).css("width");
$foo.animate({ width: "show" }, 1000); $foo.animate({ "width": "show" }, 1000);
$foo.animate({ width: "hide" }, 1000); $foo.animate({ "width": "hide" }, 1000);
$foo.animate({ width: "show" }, 1000); $foo.animate({ "width": "show" }, 1000);
setTimeout(function(){ setTimeout(function(){
equal( $foo.queue().length, 3, "All 3 still in the queue" ); equal( $foo.queue().length, 3, "All 3 still in the queue" );
var nw = $foo.css("width"); var nw = $foo.css("width");
...@@ -623,9 +623,9 @@ test("stop(clearQueue)", function() { ...@@ -623,9 +623,9 @@ test("stop(clearQueue)", function() {
var w = 0; var w = 0;
$foo.hide().css( "width", 200 ).css("width"); $foo.hide().css( "width", 200 ).css("width");
$foo.animate({ width: "show" }, 1000); $foo.animate({ "width": "show" }, 1000);
$foo.animate({ width: "hide" }, 1000); $foo.animate({ "width": "hide" }, 1000);
$foo.animate({ width: "show" }, 1000); $foo.animate({ "width": "show" }, 1000);
setTimeout(function(){ setTimeout(function(){
var nw = $foo.css("width"); var nw = $foo.css("width");
ok( parseFloat( nw ) != w, "An animation occurred " + nw + " " + w + "px"); ok( parseFloat( nw ) != w, "An animation occurred " + nw + " " + w + "px");
...@@ -999,6 +999,7 @@ jQuery.fn.saveState = function( hiddenOverflow ) { ...@@ -999,6 +999,7 @@ jQuery.fn.saveState = function( hiddenOverflow ) {
}); });
}; };
/** @expose */
jQuery.checkState = function() { jQuery.checkState = function() {
var self = this; var self = this;
jQuery.each(this.save, function( c, v ) { jQuery.each(this.save, function( c, v ) {
...@@ -1097,7 +1098,8 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function () ...@@ -1097,7 +1098,8 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
}); });
}); });
jQuery.each({ jQuery.expandedEach = jQuery.each;
jQuery.expandedEach({
"slideToggle": function( $elem ) { "slideToggle": function( $elem ) {
return parseFloat( $elem.css("height") ); return parseFloat( $elem.css("height") );
}, },
...@@ -1165,17 +1167,17 @@ test("animate with per-property easing", function(){ ...@@ -1165,17 +1167,17 @@ test("animate with per-property easing", function(){
c: 100 c: 100
}; };
jQuery.easing._test1 = function(p) { jQuery.easing["_test1"] = function(p) {
_test1_called = true; _test1_called = true;
return p; return p;
}; };
jQuery.easing._test2 = function(p) { jQuery.easing["_test2"] = function(p) {
_test2_called = true; _test2_called = true;
return p; return p;
}; };
jQuery.easing._default_test = function(p) { jQuery.easing["_default_test"] = function(p) {
_default_test_called = true; _default_test_called = true;
return p; return p;
}; };
...@@ -1198,8 +1200,8 @@ test("animate with CSS shorthand properties", function(){ ...@@ -1198,8 +1200,8 @@ test("animate with CSS shorthand properties", function(){
var _default_count = 0, var _default_count = 0,
_special_count = 0, _special_count = 0,
propsBasic = { padding: "10 20 30" }, propsBasic = { "padding": "10 20 30" },
propsSpecial = { padding: [ "1 2 3", "_special" ] }; propsSpecial = { "padding": [ "1 2 3", "_special" ] };
jQuery.easing._default = function(p) { jQuery.easing._default = function(p) {
if ( p >= 1 ) { if ( p >= 1 ) {
...@@ -1345,24 +1347,24 @@ test("animate will scale margin properties individually", function() { ...@@ -1345,24 +1347,24 @@ test("animate will scale margin properties individually", function() {
stop(); stop();
var foo = jQuery( "#foo" ).css({ var foo = jQuery( "#foo" ).css({
margin: 0, "margin": 0,
marginLeft: 100 "marginLeft": 100
}); });
ok( foo.css( "marginLeft" ) !== foo.css( "marginRight" ), "Sanity Check" ); ok( foo.css( "marginLeft" ) !== foo.css( "marginRight" ), "Sanity Check" );
foo.animate({ foo.animate({
margin: 200 "margin": 200
}).stop(); }).stop();
ok( foo.css( "marginLeft") !== foo.css( "marginRight" ), "The margin properties are different"); ok( foo.css( "marginLeft") !== foo.css( "marginRight" ), "The margin properties are different");
// clean up for next test // clean up for next test
foo.css({ foo.css({
marginLeft: "", "marginLeft": '',
marginRight: "", "marginRight": '',
marginTop: "", "marginTop": '',
marginBottom: "" "marginBottom": ''
}); });
start(); start();
}); });
...@@ -1379,17 +1381,17 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() { ...@@ -1379,17 +1381,17 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
// Start 1.8 Animation tests // Start 1.8 Animation tests
asyncTest( "jQuery.Animation( object, props, opts )", 4, function() { asyncTest( "jQuery.Animation( object, props, opts )", 4, function() {
var testObject = { var testObject = {
foo: 0, "foo": 0,
bar: 1, "bar": 1,
width: 100 "width": 100
}, },
testDest = { testDest = {
foo: 1, "foo": 1,
bar: 0, "bar": 0,
width: 200 "width": 200
}; };
var animation = jQuery.Animation( testObject, testDest, { duration: 1 }); var animation = jQuery.Animation( testObject, testDest, { "duration": 1 });
animation.done(function() { animation.done(function() {
for ( var prop in testDest ) { for ( var prop in testDest ) {
equal( testObject[ prop ], testDest[ prop ], "Animated: " + prop ); equal( testObject[ prop ], testDest[ prop ], "Animated: " + prop );
......
This diff is collapsed.
...@@ -3,13 +3,13 @@ module("manipulation", { teardown: moduleTeardown }); ...@@ -3,13 +3,13 @@ module("manipulation", { teardown: moduleTeardown });
// Ensure that an extended Array prototype doesn't break jQuery // Ensure that an extended Array prototype doesn't break jQuery
Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be called"); }; Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be called"); };
var bareObj = function(value) { return value; }; var manipulationBareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); }; var manipulationFunctionReturningObj = function(value) { return (function() { return value; }); };
/* /*
======== local reference ======= ======== local reference =======
bareObj and functionReturningObj can be used to test passing functions to setters manipulationBareObj and manipulationFunctionReturningObj can be used to test passing functions to setters
See testVal below for an example See testVal below for an example
bareObj( value ); bareObj( value );
...@@ -62,11 +62,11 @@ var testText = function(valueObj) { ...@@ -62,11 +62,11 @@ var testText = function(valueObj) {
}; };
test("text(String)", function() { test("text(String)", function() {
testText(bareObj); testText(manipulationBareObj);
}); });
test("text(Function)", function() { test("text(Function)", function() {
testText(functionReturningObj); testText(manipulationFunctionReturningObj);
}); });
test("text(Function) with incoming value", function() { test("text(Function) with incoming value", function() {
...@@ -161,11 +161,11 @@ var testWrap = function(val) { ...@@ -161,11 +161,11 @@ var testWrap = function(val) {
}; };
test("wrap(String|Element)", function() { test("wrap(String|Element)", function() {
testWrap(bareObj); testWrap(manipulationBareObj);
}); });
test("wrap(Function)", function() { test("wrap(Function)", function() {
testWrap(functionReturningObj); testWrap(manipulationFunctionReturningObj);
}); });
test("wrap(Function) with index (#10177)", function() { test("wrap(Function) with index (#10177)", function() {
...@@ -217,7 +217,7 @@ var testWrapAll = function(val) { ...@@ -217,7 +217,7 @@ var testWrapAll = function(val) {
}; };
test("wrapAll(String|Element)", function() { test("wrapAll(String|Element)", function() {
testWrapAll(bareObj); testWrapAll(manipulationBareObj);
}); });
var testWrapInner = function(val) { var testWrapInner = function(val) {
...@@ -249,11 +249,11 @@ var testWrapInner = function(val) { ...@@ -249,11 +249,11 @@ var testWrapInner = function(val) {
}; };
test("wrapInner(String|Element)", function() { test("wrapInner(String|Element)", function() {
testWrapInner(bareObj); testWrapInner(manipulationBareObj);
}); });
test("wrapInner(Function)", function() { test("wrapInner(Function)", function() {
testWrapInner(functionReturningObj); testWrapInner(manipulationFunctionReturningObj);
}); });
test("unwrap()", function() { test("unwrap()", function() {
...@@ -462,11 +462,11 @@ var testAppend = function(valueObj) { ...@@ -462,11 +462,11 @@ var testAppend = function(valueObj) {
}; };
test("append(String|Element|Array&lt;Element&gt;|jQuery)", function() { test("append(String|Element|Array&lt;Element&gt;|jQuery)", function() {
testAppend(bareObj); testAppend(manipulationBareObj);
}); });
test("append(Function)", function() { test("append(Function)", function() {
testAppend(functionReturningObj); testAppend(manipulationFunctionReturningObj);
}); });
test("append(Function) with incoming value", function() { test("append(Function) with incoming value", function() {
...@@ -531,7 +531,7 @@ test("append(Function) with incoming value", function() { ...@@ -531,7 +531,7 @@ test("append(Function) with incoming value", function() {
}); });
test("append the same fragment with events (Bug #6997, 5566)", function () { test("append the same fragment with events (Bug #6997, 5566)", function () {
var doExtra = !jQuery.support.noCloneEvent && document.fireEvent; var doExtra = !jQuery.support.noCloneEvent && document["fireEvent"];
expect(2 + (doExtra ? 1 : 0)); expect(2 + (doExtra ? 1 : 0));
stop(); stop();
...@@ -783,11 +783,11 @@ var testPrepend = function(val) { ...@@ -783,11 +783,11 @@ var testPrepend = function(val) {
}; };
test("prepend(String|Element|Array&lt;Element&gt;|jQuery)", function() { test("prepend(String|Element|Array&lt;Element&gt;|jQuery)", function() {
testPrepend(bareObj); testPrepend(manipulationBareObj);
}); });
test("prepend(Function)", function() { test("prepend(Function)", function() {
testPrepend(functionReturningObj); testPrepend(manipulationFunctionReturningObj);
}); });
test("prepend(Function) with incoming value", function() { test("prepend(Function) with incoming value", function() {
...@@ -902,11 +902,11 @@ var testBefore = function(val) { ...@@ -902,11 +902,11 @@ var testBefore = function(val) {
}; };
test("before(String|Element|Array&lt;Element&gt;|jQuery)", function() { test("before(String|Element|Array&lt;Element&gt;|jQuery)", function() {
testBefore(bareObj); testBefore(manipulationBareObj);
}); });
test("before(Function)", function() { test("before(Function)", function() {
testBefore(functionReturningObj); testBefore(manipulationFunctionReturningObj);
}); });
test("before and after w/ empty object (#10812)", function() { test("before and after w/ empty object (#10812)", function() {
...@@ -971,11 +971,11 @@ var testAfter = function(val) { ...@@ -971,11 +971,11 @@ var testAfter = function(val) {
}; };
test("after(String|Element|Array&lt;Element&gt;|jQuery)", function() { test("after(String|Element|Array&lt;Element&gt;|jQuery)", function() {
testAfter(bareObj); testAfter(manipulationBareObj);
}); });
test("after(Function)", function() { test("after(Function)", function() {
testAfter(functionReturningObj); testAfter(manipulationFunctionReturningObj);
}); });
test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() { test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() {
...@@ -1089,11 +1089,11 @@ var testReplaceWith = function(val) { ...@@ -1089,11 +1089,11 @@ var testReplaceWith = function(val) {
}; };
test("replaceWith(String|Element|Array&lt;Element&gt;|jQuery)", function() { test("replaceWith(String|Element|Array&lt;Element&gt;|jQuery)", function() {
testReplaceWith(bareObj); testReplaceWith(manipulationBareObj);
}); });
test("replaceWith(Function)", function() { test("replaceWith(Function)", function() {
testReplaceWith(functionReturningObj); testReplaceWith(manipulationFunctionReturningObj);
expect(23); expect(23);
...@@ -1259,7 +1259,7 @@ test("clone()", function() { ...@@ -1259,7 +1259,7 @@ test("clone()", function() {
equal( clone.html(), div.html(), "Element contents cloned" ); equal( clone.html(), div.html(), "Element contents cloned" );
equal( clone[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); equal( clone[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" );
div = jQuery("<div/>").data({ a: true }); div = jQuery("<div/>").data({ "a": true });
clone = div.clone(true); clone = div.clone(true);
equal( clone.data("a"), true, "Data cloned." ); equal( clone.data("a"), true, "Data cloned." );
clone.data("a", false); clone.data("a", false);
...@@ -1354,7 +1354,7 @@ test("html(undefined)", function() { ...@@ -1354,7 +1354,7 @@ test("html(undefined)", function() {
var testHtml = function(valueObj) { var testHtml = function(valueObj) {
expect(35); expect(35);
jQuery.scriptorder = 0; jQuery["scriptorder"] = 0;
var div = jQuery("#qunit-fixture > div"); var div = jQuery("#qunit-fixture > div");
div.html(valueObj("<b>test</b>")); div.html(valueObj("<b>test</b>"));
...@@ -1429,11 +1429,11 @@ var testHtml = function(valueObj) { ...@@ -1429,11 +1429,11 @@ var testHtml = function(valueObj) {
}; };
test("html(String)", function() { test("html(String)", function() {
testHtml(bareObj); testHtml(manipulationBareObj);
}); });
test("html(Function)", function() { test("html(Function)", function() {
testHtml(functionReturningObj); testHtml(manipulationFunctionReturningObj);
expect(37); expect(37);
......
This diff is collapsed.
...@@ -91,7 +91,7 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue ...@@ -91,7 +91,7 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
* @example t("Check for something", "//[a]", ["foo", "baar"]); * @example t("Check for something", "//[a]", ["foo", "baar"]);
* @param {String} a - Assertion name * @param {String} a - Assertion name
* @param {String} b - Sizzle selector * @param {String} b - Sizzle selector
* @param {String} c - Array of ids to construct what is expected * @param {Array} c - Array of ids to construct what is expected
*/ */
function t( a, b, c ) { function t( a, b, c ) {
var f = jQuery(b).get(), var f = jQuery(b).get(),
...@@ -147,7 +147,8 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue ...@@ -147,7 +147,8 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
t( "Attribute Exists", "[truespeed]", ["marquee1"]); t( "Attribute Exists", "[truespeed]", ["marquee1"]);
// Enumerated attributes (these are not boolean content attributes) // Enumerated attributes (these are not boolean content attributes)
jQuery.each([ "draggable", "contenteditable", "aria-disabled" ], function( i, val ) { jQuery.expandedEach = jQuery.each;
jQuery.expandedEach([ "draggable", "contenteditable", "aria-disabled" ], function( i, val ) {
t( "Enumerated attribute", "[" + val + "]", ["div1"]); t( "Enumerated attribute", "[" + val + "]", ["div1"]);
}); });
t( "Enumerated attribute", "[spellcheck]", ["span1"]); t( "Enumerated attribute", "[spellcheck]", ["span1"]);
...@@ -157,7 +158,7 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue ...@@ -157,7 +158,7 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
}); });
testIframe("selector/sizzle_cache", "Sizzle cache collides with multiple Sizzles on a page", function( jQuery, window, document ) { testIframe("selector/sizzle_cache", "Sizzle cache collides with multiple Sizzles on a page", function( jQuery, window, document ) {
var $cached = window.$cached; var $cached = window["$cached"];
expect(3); expect(3);
deepEqual( $cached('.test a').get(), [ document.getElementById('collision') ], "Select collision anchor with first sizzle" ); deepEqual( $cached('.test a').get(), [ document.getElementById('collision') ], "Select collision anchor with first sizzle" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment