test("$()", function() {\r
var main = $("#main");\r
isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );\r
+ \r
+ // make sure this is handled\r
+ $('<p>\r\n</p>');\r
});\r
\r
test("length", function() {\r
});\r
\r
test("attr(String)", function() {\r
- expect(12);\r
+ expect(14);\r
ok( $('#text1').attr('value') == "Test", 'Check for value attribute' );\r
ok( $('#text1').attr('type') == "text", 'Check for type attribute' );\r
ok( $('#radio1').attr('type') == "radio", 'Check for type attribute' );\r
ok( $('#name').attr('name') == "name", 'Check for name attribute' );\r
ok( $('#text1').attr('name') == "action", 'Check for name attribute' );\r
ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );\r
+ //equals( "#2", $('#anchor2').attr('href'), 'Check for non-absolute href (an anchor)' ); This fails in IE because the _config.fixture is reloaded using innerHTML\r
+ stop();\r
+ $.get("data/dashboard.xml", function(xml) {\r
+ ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" );\r
+ ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" );\r
+ start();\r
+ });\r
});\r
\r
test("attr(String, Function)", function() {\r
});\r
\r
test("attr(String, Object)", function() {\r
- expect(6);\r
+ expect(7);\r
var div = $("div");\r
div.attr("foo", "bar");\r
var pass = true;\r
if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;\r
}\r
ok( pass, "Set Attribute" );\r
+\r
+ ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" ); \r
\r
$("#name").attr('name', 'something');\r
ok( $("#name").attr('name') == 'something', 'Set name attribute' );\r
});\r
\r
test("append(String|Element|Array<Element>|jQuery)", function() {\r
- expect(9);\r
+ expect(10);\r
var defaultText = 'Try them out:'\r
var result = $('#first').append('<b>buga</b>');\r
ok( result.text() == defaultText + 'buga', 'Check if text appending works' );\r
ok( $("#sap").append([]), "Check for appending an empty array." );\r
ok( $("#sap").append(""), "Check for appending an empty string." );\r
ok( $("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." );\r
+ \r
+ reset();\r
+ $("#sap").append(document.getElementById('form'));\r
+ ok( $("#sap>form").size() == 1, "Check for appending a form" );\r
+ \r
});\r
\r
test("appendTo(String|Element|Array<Element>|jQuery)", function() {\r