🌐 AI搜索 & 代理 主页
Skip to content
Prev Previous commit
Next Next commit
Dimensions: Add a test for fractional values
  • Loading branch information
mgol committed Jul 10, 2023
commit 6c90e69aa89cd14d13fbc4791b1ca1399a537ddc
24 changes: 24 additions & 0 deletions test/unit/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,30 @@ QUnit.test( "outerHeight()", function( assert ) {
div.remove();
} );

QUnit.test( "fractional getters", function( assert ) {
assert.expect( 8 );

var elem = jQuery( "<div>" ).css( {
width: "10.5px",
height: "20.5px",
border: "10px solid white",
padding: "2px",
margin: "3px"
} );

elem.appendTo( "#qunit-fixture" );

assert.strictEqual( elem.width(), 10.5, "width supports fractions" );
assert.strictEqual( elem.innerWidth(), 14.5, "innerWidth supports fractions" );
assert.strictEqual( elem.outerWidth(), 34.5, "outerWidth supports fractions" );
assert.strictEqual( elem.outerWidth( true ), 40.5, "outerWidth( true ) supports fractions" );

assert.strictEqual( elem.height(), 20.5, "height supports fractions" );
assert.strictEqual( elem.innerHeight(), 24.5, "innerHeight supports fractions" );
assert.strictEqual( elem.outerHeight(), 44.5, "outerHeight supports fractions" );
assert.strictEqual( elem.outerHeight( true ), 50.5, "outerHeight( true ) supports fractions" );
} );

QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see trac-9441 trac-9300", function( assert ) {
assert.expect( 16 );

Expand Down