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