From 48ea2aadad11938cc5ddbd9a340c4ca1c997550d Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Sun, 17 Aug 2014 14:38:05 -0400 Subject: Draggable: Ensure overflow:visible containments are correctly measured Fixes #7016 --- tests/unit/draggable/draggable_options.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests') diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index 03a9bf355..1b7dc2b3b 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -374,6 +374,36 @@ test( "containment, account for border", function() { "The draggable should be to the right of its parent's right border" ); }); +// http://bugs.jqueryui.com/ticket/7016 +// draggable can be pulled out of containment in Chrome and IE8 +test( "containment, element cant be pulled out of container", function() { + expect( 1 ); + + var offsetBefore, + parent = $( "
").css({ width: 200, height: 200 }).appendTo( "#qunit-fixture" ), + element = $( "#draggable1" ).appendTo( parent ); + + element + .css({ + height: "5px", + width: "5px" + }) + .draggable({ containment: "parent" }) + .simulate( "drag", { + dx: 200, + dy: 200 + }); + + offsetBefore = element.offset(); + + element.simulate( "drag", { + dx: 200, + dy: 200 + }); + + deepEqual( element.offset(), offsetBefore, "The draggable should not move past bottom right edge" ); +}); + test( "containment, default, switching after initialization", function() { expect( 8 ); -- cgit v1.2.3