diff options
author | Jyoti Deka <dekajp@gmail.com> | 2013-11-01 07:06:47 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2013-12-15 12:57:29 -0500 |
commit | 20f064662a016eaa6bc580aed012022c63f675aa (patch) | |
tree | 8c58a76d7d4ac6a73fc76a07ce7c8a5f2c32524b /tests | |
parent | bae1a25b1437988686233545143fdf2c16ae8058 (diff) | |
download | jquery-ui-20f064662a016eaa6bc580aed012022c63f675aa.tar.gz jquery-ui-20f064662a016eaa6bc580aed012022c63f675aa.zip |
Resizable: containment plugin restricts resizing within container
Fixes #7018
Fixes #9107
Closes gh-1122
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/resizable/resizable_options.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index 8f1702a38..8da189d96 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -123,6 +123,37 @@ test("aspectRatio: 'preserve' (ne)", function() { equal( target.height(), 70, "compare minHeight"); }); +test( "aspectRatio: Resizing can move objects", function() { + expect( 7 ); + + // http://bugs.jqueryui.com/ticket/7018 - Resizing can move objects + var handleW = ".ui-resizable-w", + handleNW = ".ui-resizable-nw", + target = $( "#resizable1" ).resizable({ + aspectRatio: true, + handles: "all", + containment: "parent" + }); + + $( "#container" ).css({ width: 200, height: 300 }); + $( "#resizable1" ).css({ width: 100, height: 100, left: 75, top: 200 }); + + TestHelpers.resizable.drag( handleW, -20 ); + equal( target.width(), 100, "compare width - no size change" ); + equal( target.height(), 100, "compare height - no size change" ); + equal( target.position().left, 75, "compare left - no movement" ); + + // http://bugs.jqueryui.com/ticket/9107 - aspectRatio and containment not handled correctly + $( "#container" ).css({ width: 200, height: 300, position: "absolute", left: 100, top: 100 }); + $( "#resizable1" ).css({ width: 100, height: 100, left: 0, top: 0 }); + + TestHelpers.resizable.drag( handleNW, -20, -20 ); + equal( target.width(), 100, "compare width - no size change" ); + equal( target.height(), 100, "compare height - no size change" ); + equal( target.position().left, 0, "compare left - no movement" ); + equal( target.position().top, 0, "compare top - no movement" ); +}); + test( "containment", function() { expect( 6 ); var element = $( "#resizable1" ).resizable({ |