diff options
author | Jyoti Deka <dekajp@gmail.com> | 2013-11-07 09:39:51 -0500 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2013-12-15 12:29:55 -0500 |
commit | c03cb8079c6984fb9286a64d980d367d86b9cd8b (patch) | |
tree | 5a970098b8033141fca440e807e0864bc08decdb /tests/unit | |
parent | 38c6cf13829c7d010ca2575ad86526ee57c879ae (diff) | |
download | jquery-ui-c03cb8079c6984fb9286a64d980d367d86b9cd8b.tar.gz jquery-ui-c03cb8079c6984fb9286a64d980d367d86b9cd8b.zip |
Resizable: containment now works with non - immediate children
Fixes #7485
Closes gh-1130
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/resizable/resizable.html | 22 | ||||
-rw-r--r-- | tests/unit/resizable/resizable_options.js | 15 |
2 files changed, 36 insertions, 1 deletions
diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index 255c98887..bfff528fa 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -44,6 +44,22 @@ height: 100px; width: 100px; } + #container2 { + position: relative; + width: 400px; + height: 400px; + margin: 30px 0 0 30px; + } + #parent { + position: relative; + width: 300px; + height: 300px; + } + #child { + position: relative; + width: 100px; + height: 100px; + } </style> </head> <body> @@ -58,6 +74,12 @@ <div id="container"> <div id="resizable1">I'm a resizable.</div> </div> + +<div id="container2"> + <div id="parent"> + <div id="child">I'm a resizable.</div> + </div> +</div> <img src="images/test.jpg" id="resizable2" alt="solid gray"> </div> diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index 89504e363..8f1702a38 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -124,7 +124,7 @@ test("aspectRatio: 'preserve' (ne)", function() { }); test( "containment", function() { - expect( 4 ); + expect( 6 ); var element = $( "#resizable1" ).resizable({ containment: "#container" }); @@ -136,6 +136,19 @@ test( "containment", function() { TestHelpers.resizable.drag( ".ui-resizable-se", 400, 400 ); equal( element.width(), 300, "constrained width at containment edge" ); equal( element.height(), 200, "constrained height at containment edge" ); + + // http://bugs.jqueryui.com/ticket/7485 - Resizable: Containment calculation is wrong + // when containment element is not the immediate parent + element = $( "#child" ).resizable({ + containment: "#container2", + handles: "all" + }); + + TestHelpers.resizable.drag( ".ui-resizable-e", 300, 0 ); + equal( element.width(), 400, "element able to resize itself to max allowable width within container" ); + + TestHelpers.resizable.drag( ".ui-resizable-s", 0, 300 ); + equal( element.height(), 400, "element able to resize itself to max allowable height within container" ); }); test("grid", function() { |