Skip to content
Permalink
Browse files

Resize tests respecting ratio resize with dimensions limits

  • Loading branch information
eduardolundgren committed May 31, 2008
1 parent d329175 commit 8a1cba91d8cd3fe064629728ea70291f0c8d3c1f
Showing with 152 additions and 3 deletions.
  1. +0 −2 ui/tests/resizable.html
  2. +152 −1 ui/tests/resizable.js
@@ -23,8 +23,6 @@
top: 270px; left: 0px;
}*/
#main {
position:absolute;
top: -1000px; left: -1000px;
}
</style>

@@ -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");

});


});

0 comments on commit 8a1cba9

Please sign in to comment.
You can’t perform that action at this time.