Skip to content

Commit

Permalink
Fixed boolean traps.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Garmig committed Sep 8, 2024
1 parent 6dd4bf7 commit 1de8554
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
28 changes: 20 additions & 8 deletions tests/unit/resizable/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,28 +246,40 @@ QUnit.test( "nested resizable", function( assert ) {

QUnit.test( "Resizable with scrollbars and box-sizing: border-box", function( assert ) {
assert.expect( 4 );
testResizableWithBoxSizing( assert, true, false );
testResizableWithBoxSizing( assert, {
isBorderBox: true,
applyScaleTransform: false
} );
} );

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

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

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

function testResizableWithBoxSizing( assert, isBorderBox, applyScaleTransform ) {
function testResizableWithBoxSizing( assert, options ) {
var widthBefore, heightBefore,
cssBoxSizing = isBorderBox ? "border-box" : "content-box",
cssTrasform = applyScaleTransform ? "scale(1.5)" : "",
cssBoxSizing = options.isBorderBox ? "border-box" : "content-box",
cssTransform = options.applyScaleTransform ? "scale(1.5)" : "",
elementContent = $( "<div>" )
.css( {
width: "200px",
Expand All @@ -278,7 +290,7 @@ function testResizableWithBoxSizing( assert, isBorderBox, applyScaleTransform )
margin: "20px"
} )
.appendTo( "#resizable1" ),
element = $( "#resizable1" ).css( { overflow: "auto", transform: cssTrasform } ).resizable(),
element = $( "#resizable1" ).css( { overflow: "auto", transform: cssTransform } ).resizable(),
handle = ".ui-resizable-se";

$( "<style> * { box-sizing: " + cssBoxSizing + "; } </style>" ).appendTo( "#qunit-fixture" );
Expand Down
12 changes: 8 additions & 4 deletions tests/unit/resizable/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,17 +568,21 @@ 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 );
testAlsoResizeWithBoxSizing( assert, true );
testAlsoResizeWithBoxSizing( assert, {
isBorderBox: true
} );
} );

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

function testAlsoResizeWithBoxSizing( assert, isBorderBox ) {
function testAlsoResizeWithBoxSizing( assert, options ) {
var widthBefore, heightBefore,
cssBoxSizing = isBorderBox ? "border-box" : "content-box",
cssBoxSizing = options.isBorderBox ? "border-box" : "content-box",
other = $( "<div>" )
.css( {
width: "150px",
Expand Down

0 comments on commit 1de8554

Please sign in to comment.