var foo = false;
test("$('html')", function() {
- expect(5);
+ expect(6);
reset();
foo = false;
var j = $("<span>hi</span> there <!-- mon ami -->");
ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
+
+ ok( !$("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
});
test("$('html', context)", function() {
});
test("css(String, Object)", function() {
- expect(20);
+ expect(21);
ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
$('#foo').css('display', 'none');
ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
var j = $("#nonnodes").contents();
j.css("padding-left", "1px");
equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" );
+
+ // opera sometimes doesn't update 'display' correctly, see #2037
+ $("#t2037")[0].innerHTML = $("#t2037")[0].innerHTML
+ equals( $("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
});
test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
});
test("clone()", function() {
- expect(4);
+ expect(6);
ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Assert text for #en' );
var clone = $('#yahoo').clone();
ok( 'Try them out:Yahoo' == $('#first').append(clone).text(), 'Check for clone' );
// using contents will get comments regular, text, and comment nodes
var cl = $("#nonnodes").contents().clone();
ok( cl.length >= 2, "Check node,textnode,comment clone works (some browsers delete comments on clone)" );
+
+ stop();
+ $.get("data/dashboard.xml", function (xml) {
+ var root = $(xml.documentElement).clone();
+ $("tab:first", xml).text("origval");
+ $("tab:first", root).text("cloneval");
+ equals($("tab:first", xml).text(), "origval", "Check original XML node was correctly set");
+ equals($("tab:first", root).text(), "cloneval", "Check cloned XML node was correctly set");
+ start();
+ });
});
test("is(String)", function() {
});
test("not()", function() {
- expect(3);
+ expect(7);
ok( $("#main > p#ap > a").not("#google").length == 2, "not('selector')" );
+ ok( $("#main > p#ap > a").not(document.getElementById("google")).length == 2, "not(DOMElement)" );
+ isSet( $("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
+ ok( $("p").not(document.getElementsByTagName("p")).length == 0, "not(Array-like DOM collection)" );
+ isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')");
});
test("andSelf()", function() {
ok( c.has(x, "bar"), "Check has2" );
});
+test("$.data", function() {
+ expect(3);
+ var div = $("#foo")[0];
+ ok( jQuery.data(div, "test") == undefined, "Check for no data exists" );
+ jQuery.data(div, "test", "success");
+ ok( jQuery.data(div, "test") == "success", "Check for added data" );
+ jQuery.data(div, "test", "overwritten");
+ ok( jQuery.data(div, "test") == "overwritten", "Check for overwritten data" );
+});
+
+test("$.removeData", function() {
+ expect(1);
+ var div = $("#foo")[0];
+ jQuery.data(div, "test", "testing");
+ jQuery.removeData(div, "test");
+ ok( jQuery.data(div, "test") == undefined, "Check removal of data" );
+});
+
test("remove()", function() {
expect(6);
$("#ap").children().remove();