Skip to content

Commit

Permalink
Ref fb2e0a0: Synchronize unit tests with master
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisAntaki authored and gibson042 committed Nov 7, 2013
1 parent 075763b commit d0b8f9f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test/unit/manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ test( "text(undefined)", function() {

function testText( valueObj ) {

expect( 4 );
expect( 7 );

var val, j;
var val, j, expected, $multipleElements, $parentDiv, $childDiv;

val = valueObj("<div><b>Hello</b> cruel world!</div>");
equal( jQuery("#foo").text(val)[ 0 ].innerHTML.replace(/>/g, "&gt;"), "&lt;div&gt;&lt;b&gt;Hello&lt;/b&gt; cruel world!&lt;/div&gt;", "Check escaped text" );
Expand All @@ -79,6 +79,24 @@ function testText( valueObj ) {

// Blackberry 4.6 doesn't maintain comments in the DOM
equal( jQuery("#nonnodes")[ 0 ].childNodes.length < 3 ? 8 : j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" );

// Update multiple elements #11809
expected = "New";

$multipleElements = jQuery( "<div>Hello</div>" ).add( "<div>World</div>" );
$multipleElements.text( expected );

equal( $multipleElements.eq(0).text(), expected, "text() updates multiple elements (#11809)" );
equal( $multipleElements.eq(1).text(), expected, "text() updates multiple elements (#11809)" );

// Prevent memory leaks #11809
$childDiv = jQuery( "<div/>" );
$childDiv.data("leak", true);
$parentDiv = jQuery( "<div/>" );
$parentDiv.append( $childDiv );
$parentDiv.text("Dry off");

equal( $childDiv.data("leak"), undefined, "Check for leaks (#11809)" );
}

test( "text(String)", function() {
Expand Down

0 comments on commit d0b8f9f

Please sign in to comment.