Make sure that &#...; entities are encoded properly. Fixes #6042.
[jquery.git] / test / unit / manipulation.js
index 41ce8bb..e6e6c8d 100644 (file)
@@ -736,7 +736,17 @@ test("replaceWith(Function)", function() {
        });
 
        reset();
-})
+});
+
+test("replaceWith(string) for more than one element", function(){
+       expect(3);
+
+       equals(jQuery('#foo p').length, 3, 'ensuring that test data has not changed');
+
+       jQuery('#foo p').replaceWith('<span>bar</span>');
+       equals(jQuery('#foo span').length, 3, 'verify that all the three original element have been replaced');
+       equals(jQuery('#foo p').length, 0, 'verify that all the three original element have been replaced');
+});
 
 test("replaceAll(String|Element|Array&lt;Element&gt;|jQuery)", function() {
        expect(10);
@@ -841,7 +851,7 @@ test("clone() on XML nodes", function() {
 }
 
 var testHtml = function(valueObj) {
-       expect(24);
+       expect(26);
 
        jQuery.scriptorder = 0;
 
@@ -858,6 +868,9 @@ var testHtml = function(valueObj) {
        equals( div.children().length, 2, "Make sure two child nodes exist." );
        equals( div.children().children().length, 1, "Make sure that a grandchild exists." );
 
+       equals( jQuery("<div/>").html(valueObj("&#160;"))[0].innerHTML, "&nbsp;", "Make sure entities are passed through correctly." );
+       equals( jQuery("<div/>").html(valueObj("&amp;"))[0].innerHTML, "&amp;", "Make sure entities are passed through correctly." );
+
        reset();
        // using contents will get comments regular, text, and comment nodes
        var j = jQuery("#nonnodes").contents();