From 3576ceb360eb0381a98f3c6b67d890c3834efa8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Tue, 11 Mar 2014 11:50:12 +0100 Subject: [PATCH] Resizable: Remove bad workaround for draggable+resizable This adds a compound test page for draggable+resizable, which had no coverage before. Using that page shows that there is no way to reproduce the behaviour described in the original ticket that caused this workaround, since its not possible to resize an element beyond the window boundaries. Therefore removing the workaround, which is 6+ years old and has no test coverage, seems like the sanest approach. Fixes #6939 Closes gh-1210 --- tests/unit/resizable/resizable_core.js | 10 ++-- .../visual/compound/draggable_resizable.html | 51 +++++++++++++++++++ tests/visual/index.html | 1 + ui/resizable.js | 8 --- 4 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 tests/visual/compound/draggable_resizable.html diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js index f0b5cea20..f43cde623 100644 --- a/tests/unit/resizable/resizable_core.js +++ b/tests/unit/resizable/resizable_core.js @@ -171,13 +171,14 @@ test("handle with complex markup (#8756)", function() { }); test("resizable accounts for scroll position correctly (#3815)", function() { - expect( 3 ); + expect( 4 ); var position, top, left, container = $("
").appendTo("#qunit-fixture"), overflowed = $("
").appendTo( container ), el = $("
").appendTo( overflowed ).resizable({ handles: "all" }), - handle = ".ui-resizable-e"; + handle = ".ui-resizable-e", + handlePosition = $(handle).position().left; container.scrollLeft( 100 ).scrollTop( 100 ); @@ -189,6 +190,7 @@ test("resizable accounts for scroll position correctly (#3815)", function() { deepEqual( el.position(), position, "position stays the same when resized" ); equal( el.css("left"), left, "css('left') stays the same when resized" ); equal( el.css("top"), top, "css('top') stays the same when resized" ); + equal( $(handle).position().left, handlePosition + 50, "handle also moved" ); }); test( "resizable stores correct size when using helper and grid (#9547)", function() { @@ -208,7 +210,7 @@ test( "resizable stores correct size when using helper and grid (#9547)", functi test( "nested resizable", function() { expect( 4 ); - + var outer = $( "
" ), inner = $( "
" ), target = $( "#resizable1" ), @@ -224,7 +226,7 @@ test( "nested resizable", function() { innerHandle = $( "#inner > .ui-resizable-e" ); outerHandle = $( "#outer > .ui-resizable-e" ); - + TestHelpers.resizable.drag( innerHandle, 10 ); equal( inner.width(), 40, "compare width of inner element" ); TestHelpers.resizable.drag( innerHandle, -10 ); diff --git a/tests/visual/compound/draggable_resizable.html b/tests/visual/compound/draggable_resizable.html new file mode 100644 index 000000000..d38399431 --- /dev/null +++ b/tests/visual/compound/draggable_resizable.html @@ -0,0 +1,51 @@ + + + + + Compound Visual Test: Draggable and Resizable block element + + + + + + + + + + + + + +

WHAT: Three draggable and resizable elements, with only a bottom handle. Last one (red color) is absolutely positioned.

+

EXPECTED: Each element can be dragged and resized. The first two stay with their relative positioning (induced by draggable). The last one can be resized despite the absolute positioning.

+ +
+
Draggable 1-1
+
Draggable 1-2
+
Draggable 1-3
+
+ + + diff --git a/tests/visual/index.html b/tests/visual/index.html index d7b93cb53..593ddcb07 100644 --- a/tests/visual/index.html +++ b/tests/visual/index.html @@ -75,6 +75,7 @@
  • Various Widgets in Dialog
  • Draggable Accordion
  • Nested Widgets
  • +
  • Draggable Resizable
  • Sortable Tabs in Sortable Accordion
  • Nested Tabs
  • Tabs with Tooltips
  • diff --git a/ui/resizable.js b/ui/resizable.js index 741ff0406..b59f32013 100644 --- a/ui/resizable.js +++ b/ui/resizable.js @@ -287,18 +287,10 @@ $.widget("ui.resizable", $.ui.mouse, { var curleft, curtop, cursor, o = this.options, - iniPos = this.element.position(), el = this.element; this.resizing = true; - // Bugfix for http://bugs.jqueryui.com/ticket/1749 - if ( (/absolute/).test( el.css("position") ) ) { - el.css({ position: "absolute", top: el.css("top"), left: el.css("left") }); - } else if (el.is(".ui-draggable")) { - el.css({ position: "absolute", top: iniPos.top, left: iniPos.left }); - } - this._renderProxy(); curleft = this._num(this.helper.css("left"));