X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=80a93353c96bffd2eb712b3a14d1b15fb639fde3;hb=944484c3fe001bcfea52fd85612042d7475597a1;hp=1ec3487d0a94a2af623fcbff862fbc864d47c3e5;hpb=29bf601f3495ced43fbb6152bf9306f2618bb955;p=jquery.git
diff --git a/test/unit/core.js b/test/unit/core.js
index 1ec3487..80a9335 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -383,7 +383,7 @@ test("index(Object)", function() {
});
test("attr(String)", function() {
- expect(26);
+ expect(27);
equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' );
equals( jQuery('#text1').attr('value', "Test2").attr('defaultValue'), "Test", 'Check for defaultValue attribute' );
equals( jQuery('#text1').attr('type'), "text", 'Check for type attribute' );
@@ -407,6 +407,8 @@ test("attr(String)", function() {
jQuery('').attr('href', '#5').appendTo('#main'); // using innerHTML in IE causes href attribute to be serialized to the full path
equals( jQuery('#tAnchor5').attr('href'), "#5", 'Check for non-absolute href (an anchor)' );
+ equals( jQuery("").attr("selected"), false, "Check selected attribute on disconnected element." );
+
// Related to [5574] and [5683]
var body = document.body, $body = jQuery(body);
@@ -749,7 +751,7 @@ test("text()", function() {
});
test("wrap(String|Element)", function() {
- expect(8);
+ expect(10);
var defaultText = 'Try them out:'
var result = jQuery('#first').wrap('
').text();
equals( defaultText, result, 'Check for wrapping of on-the-fly html' );
@@ -774,6 +776,11 @@ test("wrap(String|Element)", function() {
j.wrap("");
equals( jQuery("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );
equals( jQuery("#nonnodes > i").text(), j.text() + j[1].nodeValue, "Check node,textnode,comment wraps doesn't hurt text" );
+
+ // Try wrapping a disconnected node
+ j = jQuery("").wrap("");
+ equals( j[0].nodeName, "LABEL", "Element is a label" );
+ equals( j[0].parentNode.nodeName, "LI", "Element has been wrapped" );
});
test("wrapAll(String|Element)", function() {
@@ -1352,7 +1359,7 @@ test("val(String/Number)", function() {
});
test("html(String)", function() {
- expect(13);
+ expect(17);
jQuery.scriptorder = 0;
@@ -1381,6 +1388,10 @@ test("html(String)", function() {
equals( $div.html( 5 ).html(), '5', 'Setting a number as html' );
equals( $div.html( 0 ).html(), '0', 'Setting a zero as html' );
+ reset();
+
+ jQuery("#main").html('');
+
stop();
jQuery("#main").html('');
@@ -1407,11 +1418,14 @@ test("filter()", function() {
});
test("closest()", function() {
- expect(4);
+ expect(6);
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)" );
+
+ isSet( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" );
+ isSet( jQuery("div").closest("body:first div:last").get(), q("divWithNoTabIndex"), "closest(body:first div:last)" );
});
test("not()", function() {