aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorEduardo Lundgren <eduardolundgren@gmail.com>2008-05-31 16:56:09 +0000
committerEduardo Lundgren <eduardolundgren@gmail.com>2008-05-31 16:56:09 +0000
commit8a1cba91d8cd3fe064629728ea70291f0c8d3c1f (patch)
tree0a8a410e05940f50241ee0c534ada15efdec2a78 /ui
parentd32917596eac2bbfcb5699990231b4b72c7639ec (diff)
downloadjquery-ui-8a1cba91d8cd3fe064629728ea70291f0c8d3c1f.tar.gz
jquery-ui-8a1cba91d8cd3fe064629728ea70291f0c8d3c1f.zip
Resize tests respecting ratio resize with dimensions limits
Diffstat (limited to 'ui')
-rw-r--r--ui/tests/resizable.html2
-rw-r--r--ui/tests/resizable.js153
2 files changed, 152 insertions, 3 deletions
diff --git a/ui/tests/resizable.html b/ui/tests/resizable.html
index 9dfc40607..f29265618 100644
--- a/ui/tests/resizable.html
+++ b/ui/tests/resizable.html
@@ -23,8 +23,6 @@
top: 270px; left: 0px;
}*/
#main {
- position:absolute;
- top: -1000px; left: -1000px;
}
</style>
diff --git a/ui/tests/resizable.js b/ui/tests/resizable.js
index 23f429414..0955b15c3 100644
--- a/ui/tests/resizable.js
+++ b/ui/tests/resizable.js
@@ -169,7 +169,7 @@ $(document).ready(function() {
* min/max Height/Width
*/
- module("Limits condition");
+ module("Dimensions limit");
test("ui-resizable-se resize xy", function() {
@@ -243,4 +243,155 @@ $(document).ready(function() {
});
+ /**
+ * Respecting ratio resize with dimensions limit
+ */
+
+ module("Respecting ratio resize with dimensions limits");
+
+ test("ui-resizable-e resize x", function() {
+
+ var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, 80);
+
+ equals( 150, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, -130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 70, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-w resize x", function() {
+
+ var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, -80);
+
+ equals( 150, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, 130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 70, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-n resize y", function() {
+
+ var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, 0, -80);
+
+ equals( 130, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, 0, 130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 50, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-n resize s", function() {
+
+ var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, 0, 80);
+
+ equals( 130, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, 0, -130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 50, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-n resize se", function() {
+
+ var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, 80, 80);
+
+ equals( 130, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, -130, -130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 50, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-n resize sw", function() {
+
+ var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, -80, 80);
+
+ equals( 130, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, 130, -130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 50, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-n resize ne", function() {
+
+ var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, 80, -80);
+
+ equals( 130, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, -130, 130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 50, target.height(), "compare minHeight");
+
+ });
+
+ test("ui-resizable-n resize nw", function() {
+
+ var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ expect(4);
+
+ drag(handle, -80, -80);
+
+ equals( 130, target.width(), "compare maxWidth");
+ equals( 130, target.height(), "compare maxHeight");
+
+ drag(handle, 130, 130);
+
+ equals( 70, target.width(), "compare minWidth");
+ equals( 50, target.height(), "compare minHeight");
+
+ });
+
+
}); \ No newline at end of file