Skip to content

Commit

Permalink
Updated tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Garmig committed Aug 25, 2024
1 parent 4ad61c9 commit 80b2c3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
16 changes: 4 additions & 12 deletions tests/unit/resizable/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ QUnit.test( "nested resizable", function( assert ) {
QUnit.test( "Resizable with scrollbars and box-sizing: border-box", function( assert ) {
assert.expect( 4 );

var style = $( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "head" );
$( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "#qunit-fixture" );

//Both scrollbars
var elementContent = $( "<div>" )
Expand All @@ -272,14 +272,12 @@ QUnit.test( "Resizable with scrollbars and box-sizing: border-box", function( as
testHelper.drag( handle, 10, 10 );
assert.equal( element.width(), 120, "element width (only vertical scrollbar)" );
assert.equal( element.height(), 120, "element height (only vertical scrollbar)" );

style.remove();
} );

QUnit.test( "Resizable with scrollbars and box-sizing: content-box", function( assert ) {
assert.expect( 4 );

var style = $( "<style> * { box-sizing: content-box; } </style>" ).appendTo( "head" );
$( "<style> * { box-sizing: content-box; } </style>" ).appendTo( "#qunit-fixture" );

//Both scrollbars
var elementContent = $( "<div>" )
Expand Down Expand Up @@ -309,14 +307,12 @@ QUnit.test( "Resizable with scrollbars and box-sizing: content-box", function( a
testHelper.drag( handle, 10, 10 );
assert.equal( parseFloat( element.innerWidth() ), widthBefore + 20, "element width (only vertical scrollbar)" );
assert.equal( parseFloat( element.innerHeight() ), heightBefore + 20, "element height (only vertical scrollbar)" );

style.remove();
} );

QUnit.test( "Resizable with scrollbars, a transform and box-sizing: border-box", function( assert ) {
assert.expect( 4 );

var style = $( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "head" );
$( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "#qunit-fixture" );

//Both scrollbars
var elementContent = $( "<div>" )
Expand All @@ -341,14 +337,12 @@ QUnit.test( "Resizable with scrollbars, a transform and box-sizing: border-box",
testHelper.drag( handle, 10, 10 );
assert.equal( element.width(), 120, "element width (only vertical scrollbar)" );
assert.equal( element.height(), 120, "element height (only vertical scrollbar)" );

style.remove();
} );

QUnit.test( "Resizable with scrollbars, a transform and box-sizing: content-box", function( assert ) {
assert.expect( 4 );

var style = $( "<style> * { box-sizing: content-box; } </style>" ).appendTo( "head" );
$( "<style> * { box-sizing: content-box; } </style>" ).appendTo( "#qunit-fixture" );

//Both scrollbars
var elementContent = $( "<div>" )
Expand Down Expand Up @@ -378,8 +372,6 @@ QUnit.test( "Resizable with scrollbars, a transform and box-sizing: content-box"
testHelper.drag( handle, 10, 10 );
assert.equal( parseFloat( element.innerWidth() ), widthBefore + 20, "element width (only vertical scrollbar)" );
assert.equal( parseFloat( element.innerHeight() ), heightBefore + 20, "element height (only vertical scrollbar)" );

style.remove();
} );

} );
24 changes: 10 additions & 14 deletions tests/unit/resizable/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,21 +542,22 @@ QUnit.test( "alsoResize + multiple selection", function( assert ) {
QUnit.test( "alsoResize with box-sizing: border-box", function( assert ) {
assert.expect( 4 );

$( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "#qunit-fixture" );

var other = $( "<div>" )
.css( {
width: 50,
height: 50,
padding: 10,
border: 5
width: "50px",
height: "50px",
padding: "10px",
border: "5px",
borderStyle: "solid"
} )
.appendTo( "body" ),
.appendTo( "#qunit-fixture" ),
element = $( "#resizable1" ).resizable( {
alsoResize: other
} ),
handle = ".ui-resizable-se";

$( "*" ).css( "box-sizing", "border-box" );

testHelper.drag( handle, 80, 80 );

assert.equal( element.width(), 180, "resizable width" );
Expand All @@ -568,7 +569,7 @@ QUnit.test( "alsoResize with box-sizing: border-box", function( assert ) {
QUnit.test( "alsoResize with scrollbars and box-sizing: border-box", function( assert ) {
assert.expect( 4 );

var style = $( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "head" );
$( "<style> * { box-sizing: border-box; } </style>" ).appendTo( "#qunit-fixture" );

var other = $( "<div>" )
.css( {
Expand All @@ -592,14 +593,12 @@ QUnit.test( "alsoResize with scrollbars and box-sizing: border-box", function( a
assert.equal( parseFloat( other.css( "width" ) ), 230, "alsoResize width" );
assert.equal( element.height(), 180, "resizable height" );
assert.equal( parseFloat( other.css( "height" ) ), 230, "alsoResize height" );

style.remove();
} );

QUnit.test( "alsoResize with scrollbars and box-sizing: content-box", function( assert ) {
assert.expect( 4 );

var style = $( "<style> * { box-sizing: content-box; } </style>" ).appendTo( "head" );
$( "<style> * { box-sizing: content-box; } </style>" ).appendTo( "#qunit-fixture" );

var other = $( "<div>" )
.css( {
Expand Down Expand Up @@ -627,9 +626,6 @@ QUnit.test( "alsoResize with scrollbars and box-sizing: content-box", function(
assert.equal( parseFloat( other.innerWidth() ), widthBefore + 80, "alsoResize width" );
assert.equal( element.height(), 180, "resizable height" );
assert.equal( parseFloat( other.innerHeight() ), heightBefore + 80, "alsoResize height" );

style.remove();
} );


} );

0 comments on commit 80b2c3a

Please sign in to comment.