From d14f61788639f0d6c9f4099508a9be2ca2025669 Mon Sep 17 00:00:00 2001 From: Jakob Stoeck Date: Mon, 25 Nov 2013 19:48:10 +0100 Subject: [PATCH] Add unit tests for .html( number ). Close gh-1447. (cherry picked from commit ed291938c287d34fe1183e588e12372e540eb5e7) --- test/unit/manipulation.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 5c83b0da5..cda534780 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -95,7 +95,7 @@ function testText( valueObj ) { $parentDiv = jQuery( "
" ); $parentDiv.append( $childDiv ); $parentDiv.text("Dry off"); - + equal( $childDiv.data("leak"), undefined, "Check for leaks (#11809)" ); } @@ -1375,7 +1375,7 @@ function childNodeNames( node ) { } function testHtml( valueObj ) { - expect( 37 ); + expect( 40 ); var actual, expected, tmp, div = jQuery("
"), @@ -1395,6 +1395,9 @@ function testHtml( valueObj ) { equal( div.html(valueObj(5)).html(), "5", "Setting a number as html" ); equal( div.html(valueObj(0)).html(), "0", "Setting a zero as html" ); + equal( div.html(valueObj(Infinity)).html(), "Infinity", "Setting Infinity as html" ); + equal( div.html(valueObj(NaN)).html(), "", "Setting NaN as html" ); + equal( div.html(valueObj(1e2)).html(), "100", "Setting exponential number notation as html" ); div.html( valueObj(" &") ); equal( @@ -1480,7 +1483,7 @@ function testHtml( valueObj ) { ok( /^[^<]*[^<\s][^<]*$/.test( fixture.html() ), "Replace html with text" ); } -test( "html(String)", function() { +test( "html(String|Number)", function() { testHtml( manipulationBareObj ); }); -- 2.39.5