2008-06-06 06:34:09 +00:00
|
|
|
/*
|
|
|
|
* resizable tests
|
|
|
|
*/
|
2008-06-09 05:59:18 +00:00
|
|
|
(function($) {
|
2008-06-26 09:49:54 +00:00
|
|
|
//
|
|
|
|
// Resizable Test Helper Functions
|
|
|
|
//
|
2008-06-06 06:34:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var defaults = {
|
2008-11-01 10:20:38 +00:00
|
|
|
animate: false,
|
|
|
|
animateDuration: 'slow',
|
|
|
|
animateEasing: 'swing',
|
|
|
|
alsoResize: false,
|
2008-06-26 09:49:54 +00:00
|
|
|
aspectRatio: false,
|
|
|
|
autoHide: false,
|
2008-11-01 10:20:38 +00:00
|
|
|
cancel: ':input',
|
|
|
|
containment: false,
|
|
|
|
delay: 0,
|
2008-06-26 09:49:54 +00:00
|
|
|
disabled: false,
|
2008-11-01 10:20:38 +00:00
|
|
|
disableSelection: true,
|
|
|
|
distance: 1,
|
|
|
|
ghost: false,
|
|
|
|
grid: false,
|
|
|
|
handles: '???',
|
|
|
|
helper: null,
|
|
|
|
knobHandles: false,
|
|
|
|
maxHeight: null,
|
|
|
|
maxWidth: null,
|
2008-06-26 09:49:54 +00:00
|
|
|
minHeight: 10,
|
|
|
|
minWidth: 10,
|
2008-11-01 10:20:38 +00:00
|
|
|
preserveCursor: true,
|
|
|
|
preventDefault: true,
|
|
|
|
proportionallyResize: false,
|
|
|
|
transparent: false
|
2008-06-26 09:49:54 +00:00
|
|
|
};
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
var drag = function(el, dx, dy, complete) {
|
|
|
|
|
|
|
|
// speed = sync -> Drag syncrhonously.
|
|
|
|
// speed = fast|slow -> Drag asyncrhonously - animated.
|
|
|
|
|
|
|
|
//this mouseover is to work around a limitation in resizable
|
|
|
|
//TODO: fix resizable so handle doesn't require mouseover in order to be used
|
|
|
|
$(el).simulate("mouseover");
|
|
|
|
|
|
|
|
return $(el).simulate("drag", {
|
|
|
|
dx: dx||0, dy: dy||0, speed: 'sync', complete: complete
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
// Resizable Tests
|
2008-06-07 18:03:19 +00:00
|
|
|
module("resizable");
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("init", function() {
|
|
|
|
expect(6);
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$("<div></div>").appendTo('body').resizable().remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, '.resizable() called on element');
|
|
|
|
|
|
|
|
$([]).resizable().remove();
|
|
|
|
ok(true, '.resizable() called on empty collection');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$('<div></div>').resizable().remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, '.resizable() called on disconnected DOMElement');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$('<div></div>').resizable().resizable("foo").remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, 'arbitrary method called after init');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
el = $('<div></div>').resizable()
|
2008-06-26 09:49:54 +00:00
|
|
|
var foo = el.data("foo.resizable");
|
|
|
|
el.remove();
|
|
|
|
ok(true, 'arbitrary option getter after init');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$('<div></div>').resizable().data("foo.resizable", "bar").remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, 'arbitrary option setter after init');
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("destroy", function() {
|
|
|
|
expect(6);
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$("<div></div>").appendTo('body').resizable().resizable("destroy").remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, '.resizable("destroy") called on element');
|
|
|
|
|
|
|
|
$([]).resizable().resizable("destroy").remove();
|
|
|
|
ok(true, '.resizable("destroy") called on empty collection');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$('<div></div>').resizable().resizable("destroy").remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, '.resizable("destroy") called on disconnected DOMElement');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$('<div></div>').resizable().resizable("destroy").resizable("foo").remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, 'arbitrary method called after destroy');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
el = $('<div></div>').resizable();
|
2008-06-26 09:49:54 +00:00
|
|
|
var foo = el.resizable("destroy").data("foo.resizable");
|
|
|
|
el.remove();
|
|
|
|
ok(true, 'arbitrary option getter after destroy');
|
|
|
|
|
2008-11-12 02:52:31 +00:00
|
|
|
$('<div></div>').resizable().resizable("destroy").data("foo.resizable", "bar").remove();
|
2008-06-26 09:49:54 +00:00
|
|
|
ok(true, 'arbitrary option setter after destroy');
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("element types", function() {
|
|
|
|
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
|
|
|
|
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
|
|
|
|
+ ',acronym,code,samp,kbd,var,img,object,hr'
|
|
|
|
+ ',input,button,label,select,iframe').split(',');
|
|
|
|
|
|
|
|
$.each(typeNames, function(i) {
|
|
|
|
var typeName = typeNames[i];
|
|
|
|
el = $(document.createElement(typeName)).appendTo('body');
|
|
|
|
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
|
|
|
|
el.resizable();
|
|
|
|
ok(true, '$("<' + typeName + '/>").resizable()');
|
|
|
|
el.resizable("destroy");
|
|
|
|
el.remove();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test("defaults", function() {
|
2008-11-12 02:52:31 +00:00
|
|
|
el = $('<div></div>').resizable();
|
2008-06-26 09:49:54 +00:00
|
|
|
$.each(defaults, function(key, val) {
|
2008-10-13 21:32:42 +00:00
|
|
|
var actual = el.data(key + ".resizable"), expected = val;
|
|
|
|
same(actual, expected, key);
|
2008-06-26 09:49:54 +00:00
|
|
|
});
|
|
|
|
el.remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
test("n", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(2);
|
2008-05-31 16:56:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 0, -50);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 150, "compare height" );
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 0, 50);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.height(), 100, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("s", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(2);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 0, 50);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 150, "compare height" );
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 0, -50);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.height(), 100, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("e", function() {
|
|
|
|
expect(2);
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
|
|
|
|
|
|
|
|
drag(handle, 50);
|
|
|
|
equals( target.width(), 150, "compare width");
|
|
|
|
|
|
|
|
drag(handle, -50);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 100, "compare width" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("w", function() {
|
|
|
|
expect(2);
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
|
|
|
|
|
|
|
|
drag(handle, -50);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.width(), 150, "compare width" );
|
2008-06-26 09:49:54 +00:00
|
|
|
|
|
|
|
drag(handle, 50);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 100, "compare width" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("ne", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, -50, -50);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.width(), 50, "compare width" );
|
|
|
|
equals( target.height(), 150, "compare height" );
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 50, 50);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 100, "compare width" );
|
|
|
|
equals( target.height(), 100, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("se", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });
|
|
|
|
|
|
|
|
drag(handle, 50, 50);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.width(), 150, "compare width" );
|
|
|
|
equals( target.height(), 150, "compare height" );
|
2008-06-26 09:49:54 +00:00
|
|
|
|
|
|
|
drag(handle, -50, -50);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 100, "compare width" );
|
|
|
|
equals( target.height(), 100, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("sw", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, -50, -50);
|
2008-06-26 09:49:54 +00:00
|
|
|
equals( target.width(), 150, "compare width" );
|
|
|
|
equals( target.height(), 50, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
drag(handle, 50, 50);
|
|
|
|
equals( target.width(), 100, "compare width" );
|
|
|
|
equals( target.height(), 100, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("nw", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' });
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
drag(handle, -50, -50);
|
|
|
|
equals( target.width(), 150, "compare width" );
|
|
|
|
equals( target.height(), 150, "compare height" );
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
drag(handle, 50, 50);
|
|
|
|
equals( target.width(), 100, "compare width" );
|
|
|
|
equals( target.height(), 100, "compare height" );
|
|
|
|
});
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
module("resizable: Options");
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (e)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 80);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, -130);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (w)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, -80);
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 130);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (n)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 0, -80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, 0, 80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (s)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 0, 80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, 0, -80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (se)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 80, 80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, -80, -80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (sw)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, -80, 80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, 80, -80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("aspectRatio: 'preserve' (ne)", function() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
|
|
|
|
2008-06-02 03:06:09 +00:00
|
|
|
drag(handle, 80, -80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 130, "compare maxWidth");
|
|
|
|
equals( target.height(), 130, "compare maxHeight");
|
2008-06-26 09:49:54 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, -80, 80);
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.width(), 70, "compare minWidth");
|
2008-06-05 12:43:09 +00:00
|
|
|
equals( target.height(), 70, "compare minHeight");
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("grid", function() {
|
|
|
|
expect(4);
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
|
2008-06-26 09:49:54 +00:00
|
|
|
|
|
|
|
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() {
|
2008-06-02 03:06:09 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
|
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, 3, 9);
|
|
|
|
equals( target.width(), 103, "compare width");
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.height(), 100, "compare height");
|
2008-06-02 03:06:09 +00:00
|
|
|
|
2008-06-05 12:43:09 +00:00
|
|
|
drag(handle, 15, 11);
|
|
|
|
equals( target.width(), 118, "compare width");
|
2008-06-04 08:47:26 +00:00
|
|
|
equals( target.height(), 120, "compare height");
|
2008-06-26 09:49:54 +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 });
|
2008-05-31 16:56:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
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" );
|
2008-06-06 20:37:32 +00:00
|
|
|
});
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
|
|
|
expect(4);
|
2008-06-06 20:37:32 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
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" );
|
2008-06-06 20:37:32 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
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() {
|
2008-06-06 20:37:32 +00:00
|
|
|
expect(4);
|
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
2008-06-06 20:37:32 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
drag(handle, -50, 50);
|
|
|
|
equals( target.width(), 60, "compare minWidth" );
|
|
|
|
equals( target.height(), 60, "compare minHeight" );
|
2008-06-06 20:37:32 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
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);
|
2008-06-06 20:37:32 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
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" );
|
2008-05-31 16:56:09 +00:00
|
|
|
|
2008-06-26 09:49:54 +00:00
|
|
|
drag(handle, -70, -70);
|
|
|
|
equals( target.width(), 100, "compare maxWidth" );
|
|
|
|
equals( target.height(), 100, "compare maxHeight" );
|
2008-06-02 03:06:09 +00:00
|
|
|
});
|
2008-06-09 05:59:18 +00:00
|
|
|
|
|
|
|
})(jQuery);
|