\r
// Check built-ins\r
// Safari uses "(Internal Function)"\r
- ok( jQuery.isFunction(String), "String Function" );\r
- ok( jQuery.isFunction(Array), "Array Function" );\r
- ok( jQuery.isFunction(Object), "Object Function" );\r
- ok( jQuery.isFunction(Function), "Function Function" );\r
+ ok( jQuery.isFunction(String), "String Function("+String+")" );\r
+ ok( jQuery.isFunction(Array), "Array Function("+Array+")" );\r
+ ok( jQuery.isFunction(Object), "Object Function("+Object+")" );\r
+ ok( jQuery.isFunction(Function), "Function Function("+Function+")" );\r
\r
// When stringified, this could be misinterpreted\r
var mystr = "function";\r
});\r
\r
test("index(Object)", function() {\r
- expect(8);\r
- equals( $([window, document]).index(window), 0, "Check for index of elements" );\r
- equals( $([window, document]).index(document), 1, "Check for index of elements" );\r
- var inputElements = $('#radio1,#radio2,#check1,#check2');\r
+ expect(10);\r
+ \r
+ var elements = $([window, document]),\r
+ inputElements = $('#radio1,#radio2,#check1,#check2');\r
+ \r
+ equals( elements.index(window), 0, "Check for index of elements" );\r
+ equals( elements.index(document), 1, "Check for index of elements" );\r
equals( inputElements.index(document.getElementById('radio1')), 0, "Check for index of elements" );\r
equals( inputElements.index(document.getElementById('radio2')), 1, "Check for index of elements" );\r
equals( inputElements.index(document.getElementById('check1')), 2, "Check for index of elements" );\r
equals( inputElements.index(document.getElementById('check2')), 3, "Check for index of elements" );\r
equals( inputElements.index(window), -1, "Check for not found index" );\r
equals( inputElements.index(document), -1, "Check for not found index" );\r
+ \r
+ // enabled since [5500]\r
+ equals( elements.index( elements ), 0, "Pass in a jQuery object" );\r
+ equals( elements.index( elements.eq(1) ), 1, "Pass in a jQuery object" );\r
});\r
\r
test("attr(String)", function() {\r
\r
test("attr(String, Object)", function() {\r
expect(17);\r
- var div = $("div");\r
- div.attr("foo", "bar");\r
- var pass = true;\r
+ var div = $("div").attr("foo", "bar");\r
+ fail = false;\r
for ( var i = 0; i < div.size(); i++ ) {\r
- if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;\r
+ if ( div.get(i).getAttribute('foo') != "bar" ){\r
+ fail = i;\r
+ break;\r
+ }\r
}\r
- ok( pass, "Set Attribute" );\r
+ equals( fail, false, "Set Attribute, the #"+fail+" element didn't get the attribute 'foo'" );\r
\r
ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" ); \r
\r
\r
j.attr("name", "attrvalue");\r
equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" );\r
- j.removeAttr("name")\r
+ j.removeAttr("name");\r
\r
reset();\r
\r