});
test("attr(String, Object)", function() {
- expect(17);
+ expect(19);
var div = jQuery("div").attr("foo", "bar");
fail = false;
for ( var i = 0; i < div.size(); i++ ) {
}
ok( thrown, "Exception thrown when trying to change type property" );
equals( "checkbox", jQuery(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
+
+ var check = jQuery("<input />");
+ var thrown = true;
+ try {
+ check.attr('type','checkbox');
+ } catch(e) {
+ thrown = false;
+ }
+ ok( thrown, "Exception thrown when trying to change type property" );
+ equals( "checkbox", check.attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
});
if ( !isLocal ) {
ok( jQuery('#en').is('[lang="de"] , [lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
});
+test("jQuery.merge()", function() {
+ expect(6);
+
+ var parse = jQuery.merge;
+
+ same( parse([],[]), [], "Empty arrays" );
+
+ same( parse([1],[2]), [1,2], "Basic" );
+ same( parse([1,2],[3,4]), [1,2,3,4], "Basic" );
+
+ same( parse([1,2],[]), [1,2], "Second empty" );
+ same( parse([],[1,2]), [1,2], "First empty" );
+
+ // Fixed at [5998], #3641
+ same( parse([-2,-1], [0,1,2]), [-2,-1,0,1,2], "Second array including a zero (falsy)");
+});
+
test("jQuery.extend(Object, Object)", function() {
expect(20);
equals( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
});
+test("closest()", function() {
+ expect(4);
+ isSet( jQuery("body").closest("body").get(), q("body"), "closest(body)" );
+ isSet( jQuery("body").closest("html").get(), q("html"), "closest(html)" );
+ isSet( jQuery("body").closest("div").get(), [], "closest(div)" );
+ isSet( jQuery("#main").closest("span,#html").get(), q("html"), "closest(span,#html)" );
+});
+
test("not()", function() {
expect(8);
equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" );
});
test("toggleClass(String)", function() {
- expect(3);
+ expect(6);\r
var e = jQuery("#firstp");
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass("test");
ok( e.is(".test"), "Assert class present" );
e.toggleClass("test");
ok( !e.is(".test"), "Assert class not present" );
+
+ e.toggleClass("test", false);\r
+ ok( !e.is(".test"), "Assert class not present" );\r
+ e.toggleClass("test", true);\r
+ ok( e.is(".test"), "Assert class present" );\r
+ e.toggleClass("test", false);\r
+ ok( !e.is(".test"), "Assert class not present" );\r
});
test("removeAttr(String", function() {