From c1fbeb934cf7e3127f26318beae8b2716f919341 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Mon, 25 Aug 2014 14:07:25 -0400 Subject: [PATCH 1/3] Resizable: alsoResize more than one element of a jQuery selection Fixes #4666 --- ui/resizable.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/ui/resizable.js b/ui/resizable.js index a02837a194f..ab4ecbf11b9 100644 --- a/ui/resizable.js +++ b/ui/resizable.js @@ -994,19 +994,7 @@ $.ui.plugin.add("resizable", "alsoResize", { }); }); }; - - if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) { - if (o.alsoResize.length) { - o.alsoResize = o.alsoResize[0]; - _store(o.alsoResize); - } else { - $.each(o.alsoResize, function(exp) { - _store(exp); - }); - } - } else { - _store(o.alsoResize); - } + _store(o.alsoResize); }, resize: function(event, ui) { @@ -1040,14 +1028,7 @@ $.ui.plugin.add("resizable", "alsoResize", { el.css(style); }); }; - - if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function(exp, c) { - _alsoResize(exp, c); - }); - } else { - _alsoResize(o.alsoResize); - } + _alsoResize(o.alsoResize); }, stop: function() { From 6ec45fcade4ca3d9334aeb126e500ba53f254087 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Thu, 28 Aug 2014 07:37:14 -0400 Subject: [PATCH 2/3] Resizable: unit test for multi-element-selection alsoResize. Ref: #4666 --- tests/unit/resizable/resizable_options.js | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index c46801bc54d..adef257f360 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -404,4 +404,34 @@ test( "alsoResize + containment", function() { equal( other.height(), 150, "alsoResize constrained height at containment edge" ); }); +test( "alsoResize + multiple selection", function() { + expect( 6 ); + var other1 = $( "
" ) + .addClass("other") + .css({ + width: 50, + height: 50 + }) + .appendTo( "body" ), + other2 = $( "
" ) + .addClass("other") + .css({ + width: 50, + height: 50 + }) + .appendTo( "body" ) + element = $( "#resizable1" ).resizable({ + alsoResize: $.merge(other1, other2), + containment: "#container" + }); + + TestHelpers.resizable.drag( ".ui-resizable-se", 400, 400 ); + equal( element.width(), 300, "resizable constrained width at containment edge" ); + equal( element.height(), 200, "resizable constrained height at containment edge" ); + equal( other1.width(), 250, "alsoResize o1 constrained width at containment edge" ); + equal( other1.height(), 150, "alsoResize o1 constrained height at containment edge" ); + equal( other2.width(), 250, "alsoResize o2 constrained width at containment edge" ); + equal( other2.height(), 150, "alsoResize o2 constrained height at containment edge" ); +}); + })(jQuery); From f3a3ad36077eea40bc1e7667e6ac5f0e4f4cf707 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Thu, 28 Aug 2014 07:43:45 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Resizable:=20unit=20test=20typo=20(missing?= =?UTF-8?q?=20comma).=20=F0=9F=98=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/resizable/resizable_options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index adef257f360..25dcc9f5472 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -419,7 +419,7 @@ test( "alsoResize + multiple selection", function() { width: 50, height: 50 }) - .appendTo( "body" ) + .appendTo( "body"), element = $( "#resizable1" ).resizable({ alsoResize: $.merge(other1, other2), containment: "#container"