X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=49976345d55e4e3c1ccbe9171706405c5b43dbb7;hb=ac00fe5bbb2a95fdb747f76fd9dd7c58ba6a531c;hp=00984168ca385de088031b221f029fc9128687fa;hpb=4bda398e6aa63082c41bb0d06fcc184acd7f76c5;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 0098416..4997634 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -4,9 +4,12 @@ var bareObj = function(value) { return value; }; var functionReturningObj = function(value) { return (function() { return value; }); }; test("text()", function() { - expect(1); + expect(2); var expected = "This link has class=\"blog\": Simon Willison's Weblog"; equals( jQuery('#sap').text(), expected, 'Check for merged text of more then one element.' ); + + // Check serialization of text values + equals( jQuery(document.createTextNode("foo")).text(), "foo", "Text node was retreived from .text()." ); }); var testWrap = function(val) { @@ -643,7 +646,7 @@ test("val(Function)", function() { }) var testHtml = function(valueObj) { - expect(17); + expect(20); window.debug = true; @@ -676,6 +679,12 @@ var testHtml = function(valueObj) { equals( $div.html(valueObj( 5 )).html(), '5', 'Setting a number as html' ); equals( $div.html(valueObj( 0 )).html(), '0', 'Setting a zero as html' ); + var $div2 = jQuery('
'), insert = "<div>hello1</div>"; + equals( $div2.html(insert).html(), insert, "Verify escaped insertion." ); + equals( $div2.html("x" + insert).html(), "x" + insert, "Verify escaped insertion." ); + equals( $div2.html(" " + insert).html(), " " + insert, "Verify escaped insertion." ); + + reset(); jQuery("#main").html(valueObj('
'));