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; } 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