Commit d14f6178 authored by Jakob Stoeck's avatar Jakob Stoeck Committed by Richard Gibson

Add unit tests for .html( number ). Close gh-1447.

(cherry picked from commit ed291938)
parent e07c00be
...@@ -95,7 +95,7 @@ function testText( valueObj ) { ...@@ -95,7 +95,7 @@ function testText( valueObj ) {
$parentDiv = jQuery( "<div/>" ); $parentDiv = jQuery( "<div/>" );
$parentDiv.append( $childDiv ); $parentDiv.append( $childDiv );
$parentDiv.text("Dry off"); $parentDiv.text("Dry off");
equal( $childDiv.data("leak"), undefined, "Check for leaks (#11809)" ); equal( $childDiv.data("leak"), undefined, "Check for leaks (#11809)" );
} }
...@@ -1375,7 +1375,7 @@ function childNodeNames( node ) { ...@@ -1375,7 +1375,7 @@ function childNodeNames( node ) {
} }
function testHtml( valueObj ) { function testHtml( valueObj ) {
expect( 37 ); expect( 40 );
var actual, expected, tmp, var actual, expected, tmp,
div = jQuery("<div></div>"), div = jQuery("<div></div>"),
...@@ -1395,6 +1395,9 @@ function testHtml( valueObj ) { ...@@ -1395,6 +1395,9 @@ function testHtml( valueObj ) {
equal( div.html(valueObj(5)).html(), "5", "Setting a number as html" ); 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(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("&#160;&amp;") ); div.html( valueObj("&#160;&amp;") );
equal( equal(
...@@ -1480,7 +1483,7 @@ function testHtml( valueObj ) { ...@@ -1480,7 +1483,7 @@ function testHtml( valueObj ) {
ok( /^[^<]*[^<\s][^<]*$/.test( fixture.html() ), "Replace html with text" ); ok( /^[^<]*[^<\s][^<]*$/.test( fixture.html() ), "Replace html with text" );
} }
test( "html(String)", function() { test( "html(String|Number)", function() {
testHtml( manipulationBareObj ); testHtml( manipulationBareObj );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment