diff options
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({ |