summaryrefslogtreecommitdiff
path: root/src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2011-11-25 21:18:19 +0100
committerLeif Johansson <leifj@sunet.se>2011-11-25 21:18:19 +0100
commit3909e6d89e01e4cd8777377c63037896bb95aa2f (patch)
tree59679df287c2bee55087fb5afb8d42e7f93a44fb /src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js
parente5f94e9be5017f627c1ccd8c6306c5cc2e200432 (diff)
new jq layout
Diffstat (limited to 'src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js')
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js190
1 files changed, 190 insertions, 0 deletions
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js
new file mode 100644
index 0000000..389931f
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/resizable/resizable_options.js
@@ -0,0 +1,190 @@
+/*
+ * resizable_options.js
+ */
+(function($) {
+
+module("resizable: options");
+
+test("aspectRatio: 'preserve' (e)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, 80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, -130);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("aspectRatio: 'preserve' (w)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, -80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, 130);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("aspectRatio: 'preserve' (n)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, 0, -80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, 0, 80);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("aspectRatio: 'preserve' (s)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, 0, 80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, 0, -80);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("aspectRatio: 'preserve' (se)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, 80, 80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, -80, -80);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("aspectRatio: 'preserve' (sw)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, -80, 80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, 80, -80);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("aspectRatio: 'preserve' (ne)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
+
+ drag(handle, 80, -80);
+ equals( target.width(), 130, "compare maxWidth");
+ equals( target.height(), 130, "compare maxHeight");
+
+ drag(handle, -80, 80);
+ equals( target.width(), 70, "compare minWidth");
+ equals( target.height(), 70, "compare minHeight");
+});
+
+test("grid", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
+
+ drag(handle, 3, 9);
+ equals( target.width(), 103, "compare width");
+ equals( target.height(), 100, "compare height");
+
+ drag(handle, 15, 11);
+ equals( target.width(), 118, "compare width");
+ equals( target.height(), 120, "compare height");
+});
+
+test("grid (wrapped)", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
+
+ drag(handle, 3, 9);
+ equals( target.width(), 103, "compare width");
+ equals( target.height(), 100, "compare height");
+
+ drag(handle, 15, 11);
+ equals( target.width(), 118, "compare width");
+ equals( target.height(), 120, "compare height");
+});
+
+test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
+
+ drag(handle, -50, -50);
+ equals( target.width(), 60, "compare minWidth" );
+ equals( target.height(), 60, "compare minHeight" );
+
+ drag(handle, 70, 70);
+ equals( target.width(), 100, "compare maxWidth" );
+ equals( target.height(), 100, "compare maxHeight" );
+});
+
+test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
+
+ drag(handle, 50, -50);
+ equals( target.width(), 60, "compare minWidth" );
+ equals( target.height(), 60, "compare minHeight" );
+
+ drag(handle, -70, 70);
+ equals( target.width(), 100, "compare maxWidth" );
+ equals( target.height(), 100, "compare maxHeight" );
+});
+
+test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
+
+ drag(handle, -50, 50);
+ equals( target.width(), 60, "compare minWidth" );
+ equals( target.height(), 60, "compare minHeight" );
+
+ drag(handle, 70, -70);
+ equals( target.width(), 100, "compare maxWidth" );
+ equals( target.height(), 100, "compare maxHeight" );
+});
+
+test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
+ expect(4);
+
+ var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
+
+ drag(handle, 70, 70);
+ equals( target.width(), 60, "compare minWidth" );
+ equals( target.height(), 60, "compare minHeight" );
+
+ drag(handle, -70, -70);
+ equals( target.width(), 100, "compare maxWidth" );
+ equals( target.height(), 100, "compare maxHeight" );
+});
+
+})(jQuery);