aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorSergei Ratnikov <sergeir82@gmail.com>2016-09-23 18:42:21 +0300
committerScott González <scott.gonzalez@gmail.com>2016-09-28 11:55:13 -0400
commitc481400f222c871ba5853bc2930a3b8b4375d08b (patch)
treef3483753045df629efc76c9933a39206ea4d3331 /tests/unit
parentc218bee80d7b7858b7e2b7c44d01d6995a18b6e4 (diff)
downloadjquery-ui-c481400f222c871ba5853bc2930a3b8b4375d08b.tar.gz
jquery-ui-c481400f222c871ba5853bc2930a3b8b4375d08b.zip
Resizable: Fix aspectRatio cannot be changed after initialization.
Fixes #4186 Closes gh-1750
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/resizable/options.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/resizable/options.js b/tests/unit/resizable/options.js
index 03c40ff98..f89682593 100644
--- a/tests/unit/resizable/options.js
+++ b/tests/unit/resizable/options.js
@@ -155,6 +155,28 @@ QUnit.test( "aspectRatio: Resizing can move objects", function( assert ) {
assert.equal( target.position().top, 0, "compare top - no movement" );
} );
+QUnit.test( "aspectRatio: aspectRatio can be changed after initialization", function( assert ) {
+ assert.expect( 4 );
+
+ var target = $( "#resizable1" )
+ .resizable( { aspectRatio: 1 } )
+ .resizable( "option", "aspectRatio", false );
+
+ var handle = ".ui-resizable-e";
+
+ testHelper.drag( handle, 80 );
+
+ assert.equal( target.width(), 180, "compare width - 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 ) {
assert.expect( 4 );