diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-05-31 16:26:43 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-05-31 16:26:43 +0000 |
commit | 8c6334af979de8859d7927927a7eec9859398937 (patch) | |
tree | 9b16836e372b885b1df57ab0b9b9f94950e550d3 | |
parent | 2e7ad670ea32d0c18964d401f31ee55064073deb (diff) | |
download | jquery-ui-8c6334af979de8859d7927927a7eec9859398937.tar.gz jquery-ui-8c6334af979de8859d7927927a7eec9859398937.zip |
Resizable limit min/max dimensions tests
-rw-r--r-- | ui/tests/resizable.js | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/ui/tests/resizable.js b/ui/tests/resizable.js index 943e226ce..0d066c11a 100644 --- a/ui/tests/resizable.js +++ b/ui/tests/resizable.js @@ -26,7 +26,7 @@ $(document).ready(function() { }); }; - module("simple resize"); + module("Simple Resize"); test("ui-resizable-e resize x", function() { @@ -164,5 +164,83 @@ $(document).ready(function() { }); + /** + * Conditional Resize + * min/max Height/Width + */ + + module("Limits condition"); + + test("ui-resizable-se resize xy", function() { + + var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); + + expect(4); + + drag(handle, -50, -50); + + equals( 60, target.width(), "compare minWidth" ); + equals( 60, target.height(), "compare minHeight" ); + + drag(handle, 70, 70); + + equals( 100, target.width(), "compare maxWidth" ); + equals( 100, target.height(), "compare maxHeight" ); + + }); + + test("ui-resizable-sw resize xy", function() { + + var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); + + expect(4); + + drag(handle, 50, -50); + + equals( 60, target.width(), "compare minWidth" ); + equals( 60, target.height(), "compare minHeight" ); + + drag(handle, -70, 70); + + equals( 100, target.width(), "compare maxWidth" ); + equals( 100, target.height(), "compare maxHeight" ); + + }); + + test("ui-resizable-ne resize xy", function() { + + var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); + + expect(4); + + drag(handle, -50, 50); + + equals( 60, target.width(), "compare minWidth" ); + equals( 60, target.height(), "compare minHeight" ); + + drag(handle, 70, -70); + + equals( 100, target.width(), "compare maxWidth" ); + equals( 100, target.height(), "compare maxHeight" ); + + }); + + test("ui-resizable-nw resize xy", function() { + + var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); + + expect(4); + + drag(handle, 70, 70); + + equals( 60, target.width(), "compare minWidth" ); + equals( 60, target.height(), "compare minHeight" ); + + drag(handle, -70, -70); + + equals( 100, target.width(), "compare maxWidth" ); + equals( 100, target.height(), "compare maxHeight" ); + + }); });
\ No newline at end of file |