aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-12-03 10:36:55 -0500
committerScott González <scott.gonzalez@gmail.com>2012-12-03 10:36:55 -0500
commit5ba267e7c78f0bc257383c822d241c5369e8e49d (patch)
tree042ccabe0ad97a6f1bb276ff7587b448e145fdbc /tests
parentc6a755dd8c330de78f407dd037eb600a240f23ee (diff)
downloadjquery-ui-5ba267e7c78f0bc257383c822d241c5369e8e49d.tar.gz
jquery-ui-5ba267e7c78f0bc257383c822d241c5369e8e49d.zip
Resizable: Respect containment for alsoResize option. Fixes #4603 - Resizable: alsoResize option doesn't work with containment. Fixes #5559 - Dialog: Content grows bigger than widget on resize at document edge.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/resizable/resizable.html26
-rw-r--r--tests/unit/resizable/resizable_options.js55
2 files changed, 71 insertions, 10 deletions
diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html
index 0a27f2a80..255c98887 100644
--- a/tests/unit/resizable/resizable.html
+++ b/tests/unit/resizable/resizable.html
@@ -31,15 +31,19 @@
<script src="../swarminject.js"></script>
<style>
- #resizable1 {
- background: green;
- height: 100px;
- width: 100px;
- }
- #resizable2 {
- height: 100px;
- width: 100px;
- }
+ #container {
+ width: 300px;
+ height: 200px;
+ }
+ #resizable1 {
+ background: green;
+ height: 100px;
+ width: 100px;
+ }
+ #resizable2 {
+ height: 100px;
+ width: 100px;
+ }
</style>
</head>
<body>
@@ -51,7 +55,9 @@
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
-<div id="resizable1">I'm a resizable.</div>
+<div id="container">
+ <div id="resizable1">I'm a resizable.</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 4b47762ab..d79523183 100644
--- a/tests/unit/resizable/resizable_options.js
+++ b/tests/unit/resizable/resizable_options.js
@@ -5,6 +5,26 @@
module("resizable: options");
+test( "alsoResize", function() {
+ expect( 2 );
+
+ var other = $( "<div>" )
+ .css({
+ width: 50,
+ height: 50
+ })
+ .appendTo( "body" ),
+ element = $( "#resizable1" ).resizable({
+ alsoResize: other
+ }),
+ handle = ".ui-resizable-e";
+
+ TestHelpers.resizable.drag( handle, 80 );
+ equal( element.width(), 180, "resizable width" );
+ equal( other.width(), 130, "alsoResize width" );
+});
+
+
test("aspectRatio: 'preserve' (e)", function() {
expect(4);
@@ -103,6 +123,21 @@ test("aspectRatio: 'preserve' (ne)", function() {
equal( target.height(), 70, "compare minHeight");
});
+test( "containment", function() {
+ expect( 4 );
+ var element = $( "#resizable1" ).resizable({
+ containment: "#container"
+ });
+
+ TestHelpers.resizable.drag( ".ui-resizable-se", 20, 30 );
+ equal( element.width(), 120, "unconstrained width within container" );
+ equal( element.height(), 130, "unconstrained height within container" );
+
+ 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" );
+});
+
test("grid", function() {
expect(4);
@@ -210,4 +245,24 @@ test("zIndex, applied to all handles", function() {
});
});
+test( "alsoResize + containment", function() {
+ expect( 4 );
+ var other = $( "<div>" )
+ .css({
+ width: 50,
+ height: 50
+ })
+ .appendTo( "body" ),
+ element = $( "#resizable1" ).resizable({
+ alsoResize: other,
+ 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( other.width(), 250, "alsoResize constrained width at containment edge" );
+ equal( other.height(), 150, "alsoResize constrained height at containment edge" );
+});
+
})(jQuery);