X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=d4cc165c5b43d34688b29678ad536e5e2724094c;hb=6a9b73c7b97b7a1dbb3febde80aef70ebe162cd2;hp=07ecd5aca4e288bdd4def75d530537ec020df690;hpb=96ca83d1501a2ffa78332c35d4a7afefe600f1ee;p=jquery.git
diff --git a/test/unit/core.js b/test/unit/core.js
index 07ecd5a..d4cc165 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -261,10 +261,10 @@ test("get(Number)", function() {
});
test("add(String|Element|Array|undefined)", function() {
- expect(8);
+ expect(12);
isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
- equals( $([]).add($("#form")[0].elements).length, 15, "Check elements from array" );
+ ok( $([]).add($("#form")[0].elements).length >= 13, "Check elements from array" );
// For the time being, we're discontinuing support for $(form.elements) since it's ambiguous in IE
// use $([]).add(form.elements) instead.
@@ -280,6 +280,12 @@ test("add(String|Element|Array|undefined)", function() {
var notDefined;
equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing" );
+
+ // Added after #2811
+ equals( $([]).add([window,document,document.body,document]).length, 3, "Pass an array" );
+ equals( $(document).add(document).length, 1, "Check duplicated elements" );
+ equals( $(window).add(window).length, 1, "Check duplicated elements using the window" );
+ ok( $([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" );
});
test("each(Function)", function() {
@@ -1148,6 +1154,9 @@ test("html(String)", function() {
// using contents will get comments regular, text, and comment nodes
var j = $("#nonnodes").contents();
j.html("bold");
+
+ // this is needed, or the expando added by jQuery unique will yield a different html
+ j.find('b').removeData();
equals( j.html().toLowerCase(), "bold", "Check node,textnode,comment with html()" );
$("#main").html("");
@@ -1650,5 +1659,5 @@ test("$.makeArray", function(){
equals( $.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" );
- equals( $.makeArray(document.getElementById('form')).length, 15, "Pass makeArray a form (treat as elements)" );
-});
\ No newline at end of file
+ ok( $.makeArray(document.getElementById('form')).length >= 13, "Pass makeArray a form (treat as elements)" );
+});