Resizable: Fix aspectRatio cannot be changed after initialization.

Add tests for setting  aspectRatio numeric value.

Fixes #4186
This commit is contained in:
Sergei Ratnikov 2016-09-28 12:31:19 +03:00
parent ffeb5aba12
commit 02796d6dac

View File

@ -156,7 +156,7 @@ QUnit.test( "aspectRatio: Resizing can move objects", function( assert ) {
} ); } );
QUnit.test( "aspectRatio: aspectRatio can be changed after initialization", function( assert ) { QUnit.test( "aspectRatio: aspectRatio can be changed after initialization", function( assert ) {
assert.expect( 2 ); assert.expect( 4 );
var target = $( "#resizable1" ) var target = $( "#resizable1" )
.resizable( { aspectRatio: 1 } ) .resizable( { aspectRatio: 1 } )
@ -168,6 +168,13 @@ QUnit.test( "aspectRatio: aspectRatio can be changed after initialization", func
assert.equal( target.width(), 180, "compare width - size change" ); assert.equal( target.width(), 180, "compare width - size change" );
assert.equal( target.height(), 100, "compare height - no size change" ); assert.equal( target.height(), 100, "compare height - no size change" );
target.resizable( "option", "aspectRatio", 2 );
testHelper.drag( handle, -40 );
assert.equal( target.width(), 140, "compare width - size change" );
assert.equal( target.height(), 70, "compare height - size change in proper relation" );
} ); } );
QUnit.test( "containment", function( assert ) { QUnit.test( "containment", function( assert ) {