2009-02-02 14:36:08 +00:00
|
|
|
/*
|
|
|
|
* resizable_options.js
|
|
|
|
*/
|
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("resizable: options");
|
|
|
|
|
2009-02-04 04:47:39 +00:00
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, -130);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 130);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 0, 80);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 0, -80);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, -80, -80);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 80, -80);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 130, "compare maxWidth");
|
|
|
|
equal( target.height(), 130, "compare maxHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, -80, 80);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 70, "compare minWidth");
|
|
|
|
equal( target.height(), 70, "compare minHeight");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test("grid", function() {
|
|
|
|
expect(4);
|
|
|
|
|
|
|
|
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
|
|
|
|
|
|
|
|
drag(handle, 3, 9);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 103, "compare width");
|
|
|
|
equal( target.height(), 100, "compare height");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 15, 11);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 118, "compare width");
|
|
|
|
equal( target.height(), 120, "compare height");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test("grid (wrapped)", function() {
|
|
|
|
expect(4);
|
|
|
|
|
|
|
|
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
|
|
|
|
|
|
|
|
drag(handle, 3, 9);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 103, "compare width");
|
|
|
|
equal( target.height(), 100, "compare height");
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 15, 11);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 118, "compare width");
|
|
|
|
equal( target.height(), 120, "compare height");
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 60, "compare minWidth" );
|
|
|
|
equal( target.height(), 60, "compare minHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 70, 70);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 100, "compare maxWidth" );
|
|
|
|
equal( target.height(), 100, "compare maxHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 60, "compare minWidth" );
|
|
|
|
equal( target.height(), 60, "compare minHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, -70, 70);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 100, "compare maxWidth" );
|
|
|
|
equal( target.height(), 100, "compare maxHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 60, "compare minWidth" );
|
|
|
|
equal( target.height(), 60, "compare minHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, 70, -70);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 100, "compare maxWidth" );
|
|
|
|
equal( target.height(), 100, "compare maxHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 60, "compare minWidth" );
|
|
|
|
equal( target.height(), 60, "compare minHeight" );
|
2009-02-04 04:47:39 +00:00
|
|
|
|
|
|
|
drag(handle, -70, -70);
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( target.width(), 100, "compare maxWidth" );
|
|
|
|
equal( target.height(), 100, "compare maxHeight" );
|
2009-02-02 14:36:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|