Make sure that checked state is cloned properly. Based upon the patch by Michael...
[jquery.git] / test / unit / manipulation.js
index 16992ae..b0a1c71 100644 (file)
@@ -197,7 +197,7 @@ test("unwrap()", function() {
 });
 
 var testAppend = function(valueObj) {
-       expect(22);
+       expect(37);
        var defaultText = 'Try them out:'
        var result = jQuery('#first').append(valueObj('<b>buga</b>'));
        equals( result.text(), defaultText + 'buga', 'Check if text appending works' );
@@ -230,6 +230,24 @@ var testAppend = function(valueObj) {
        ok( jQuery("#sap").append(valueObj( [] )), "Check for appending an empty array." );
        ok( jQuery("#sap").append(valueObj( "" )), "Check for appending an empty string." );
        ok( jQuery("#sap").append(valueObj( document.getElementsByTagName("foo") )), "Check for appending an empty nodelist." );
+       
+       reset();
+       jQuery("form").append(valueObj('<input name="radiotest" type="radio" checked="checked" />'));
+       jQuery("form input[name=radiotest]").each(function(){
+               ok( jQuery(this).is(':checked'), "Append checked radio");
+       }).remove();
+
+       reset();
+       jQuery("form").append(valueObj('<input name="radiotest" type="radio" checked    =   \'checked\' />'));
+       jQuery("form input[name=radiotest]").each(function(){
+               ok( jQuery(this).is(':checked'), "Append alternately formated checked radio");
+       }).remove();
+
+       reset();
+       jQuery("form").append(valueObj('<input name="radiotest" type="radio" checked />'));
+       jQuery("form input[name=radiotest]").each(function(){
+               ok( jQuery(this).is(':checked'), "Append HTML5-formated checked radio");
+       }).remove();
 
        reset();
        jQuery("#sap").append(valueObj( document.getElementById('form') ));
@@ -977,7 +995,7 @@ test("empty()", function() {
 });
 
 test("jQuery.cleanData", function() {
-       expect(10);
+       expect(14);
        
        var type, pos, div, child;
        
@@ -1007,6 +1025,9 @@ test("jQuery.cleanData", function() {
        // Should do nothing
        pos = "Inner";
        child.trigger("click");
+
+       // Should trigger 2
+       div.remove();
        
        type = "html";
        
@@ -1023,6 +1044,9 @@ test("jQuery.cleanData", function() {
        // Should do nothing
        pos = "Inner";
        child.trigger("click");
+
+       // Should trigger 2
+       div.remove();
        
        function getDiv() {
                var div = jQuery("<div class='outer'><div class='inner'></div></div>").click(function(){