-/*
- * resizable_core.js
- */
-
-(function($) {
+define( [
+ "jquery",
+ "./resizable_test_helpers",
+ "ui/resizable"
+], function( $, resizableTestHelpers ) {
module("resizable: core");
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, 0, -50);
+ resizableTestHelpers.drag(handle, 0, -50);
equal( target.height(), 150, "compare height" );
- TestHelpers.resizable.drag(handle, 0, 50);
+ resizableTestHelpers.drag(handle, 0, 50);
equal( target.height(), 100, "compare height" );
equal( target[0].style.left, "", "left should not be modified" );
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, 0, 50);
+ resizableTestHelpers.drag(handle, 0, 50);
equal( target.height(), 150, "compare height" );
- TestHelpers.resizable.drag(handle, 0, -50);
+ resizableTestHelpers.drag(handle, 0, -50);
equal( target.height(), 100, "compare height" );
equal( target[0].style.top, "", "top should not be modified" );
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, 50);
+ resizableTestHelpers.drag(handle, 50);
equal( target.width(), 150, "compare width");
- TestHelpers.resizable.drag(handle, -50);
+ resizableTestHelpers.drag(handle, -50);
equal( target.width(), 100, "compare width" );
equal( target[0].style.height, "", "height should not be modified" );
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, -50);
+ resizableTestHelpers.drag(handle, -50);
equal( target.width(), 150, "compare width" );
- TestHelpers.resizable.drag(handle, 50);
+ resizableTestHelpers.drag(handle, 50);
equal( target.width(), 100, "compare width" );
equal( target[0].style.height, "", "height should not be modified" );
var handle = ".ui-resizable-ne", target = $("#resizable1").css({ overflow: "hidden" }).resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, -50, -50);
+ resizableTestHelpers.drag(handle, -50, -50);
equal( target.width(), 50, "compare width" );
equal( target.height(), 150, "compare height" );
- TestHelpers.resizable.drag(handle, 50, 50);
+ resizableTestHelpers.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, 50, 50);
+ resizableTestHelpers.drag(handle, 50, 50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- TestHelpers.resizable.drag(handle, -50, -50);
+ resizableTestHelpers.drag(handle, -50, -50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, -50, -50);
+ resizableTestHelpers.drag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 50, "compare height" );
- TestHelpers.resizable.drag(handle, 50, 50);
+ resizableTestHelpers.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, -50, -50);
+ resizableTestHelpers.drag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- TestHelpers.resizable.drag(handle, 50, 50);
+ resizableTestHelpers.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
var handle = ".ui-resizable-w div", target = $("#resizable1").resizable({ handles: "all" });
- TestHelpers.resizable.drag(handle, -50);
+ resizableTestHelpers.drag(handle, -50);
equal( target.width(), 150, "compare width" );
- TestHelpers.resizable.drag(handle, 50);
+ resizableTestHelpers.drag(handle, 50);
equal( target.width(), 100, "compare width" );
});
left = el.css("left");
top = el.css("top");
- TestHelpers.resizable.drag(handle, 50, 50);
+ resizableTestHelpers.drag(handle, 50, 50);
deepEqual( el.position(), position, "position stays the same when resized" );
equal( el.css("left"), left, "css('left') stays the same when resized" );
equal( el.css("top"), top, "css('top') stays the same when resized" );
grid: [ 10, 10 ]
});
- TestHelpers.resizable.drag( handle, 1, 1 );
+ resizableTestHelpers.drag( handle, 1, 1 );
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
innerHandle = $( "#inner > .ui-resizable-e" );
outerHandle = $( "#outer > .ui-resizable-e" );
- TestHelpers.resizable.drag( innerHandle, 10 );
+ resizableTestHelpers.drag( innerHandle, 10 );
equal( inner.width(), 40, "compare width of inner element" );
- TestHelpers.resizable.drag( innerHandle, -10 );
+ resizableTestHelpers.drag( innerHandle, -10 );
equal( inner.width(), 30, "compare width of inner element" );
- TestHelpers.resizable.drag( outerHandle, 10 );
+ resizableTestHelpers.drag( outerHandle, 10 );
equal( outer.width(), 60, "compare width of outer element" );
- TestHelpers.resizable.drag( outerHandle, -10 );
+ resizableTestHelpers.drag( outerHandle, -10 );
equal( outer.width(), 50, "compare width of outer element" );
inner.remove();
outer.remove();
});
-})(jQuery);
+} );
-/*
- * resizable_options.js
- */
-(function($) {
+define( [
+ "jquery",
+ "./resizable_test_helpers",
+ "ui/resizable"
+], function( $, resizableTestHelpers ) {
module("resizable: options");
}),
handle = ".ui-resizable-e";
- TestHelpers.resizable.drag( handle, 80 );
+ resizableTestHelpers.drag( handle, 80 );
equal( element.width(), 180, "resizable width" );
equal( other.width(), 130, "alsoResize width" );
});
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, 80);
+ resizableTestHelpers.drag(handle, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, -130);
+ resizableTestHelpers.drag(handle, -130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, -80);
+ resizableTestHelpers.drag(handle, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, 130);
+ resizableTestHelpers.drag(handle, 130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, 0, -80);
+ resizableTestHelpers.drag(handle, 0, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, 0, 80);
+ resizableTestHelpers.drag(handle, 0, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, 0, 80);
+ resizableTestHelpers.drag(handle, 0, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, 0, -80);
+ resizableTestHelpers.drag(handle, 0, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, 80, 80);
+ resizableTestHelpers.drag(handle, 80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, -80, -80);
+ resizableTestHelpers.drag(handle, -80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, -80, 80);
+ resizableTestHelpers.drag(handle, -80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, 80, -80);
+ resizableTestHelpers.drag(handle, 80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- TestHelpers.resizable.drag(handle, 80, -80);
+ resizableTestHelpers.drag(handle, 80, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- TestHelpers.resizable.drag(handle, -80, 80);
+ resizableTestHelpers.drag(handle, -80, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
$( "#container" ).css({ width: 200, height: 300 });
$( "#resizable1" ).css({ width: 100, height: 100, left: 75, top: 200 });
- TestHelpers.resizable.drag( handleW, -20 );
+ resizableTestHelpers.drag( handleW, -20 );
equal( target.width(), 100, "compare width - no size change" );
equal( target.height(), 100, "compare height - no size change" );
equal( target.position().left, 75, "compare left - no movement" );
$( "#container" ).css({ width: 200, height: 300, position: "absolute", left: 100, top: 100 });
$( "#resizable1" ).css({ width: 100, height: 100, left: 0, top: 0 });
- TestHelpers.resizable.drag( handleNW, -20, -20 );
+ resizableTestHelpers.drag( handleNW, -20, -20 );
equal( target.width(), 100, "compare width - no size change" );
equal( target.height(), 100, "compare height - no size change" );
equal( target.position().left, 0, "compare left - no movement" );
containment: "#container"
});
- TestHelpers.resizable.drag( ".ui-resizable-se", 20, 30 );
+ resizableTestHelpers.drag( ".ui-resizable-se", 20, 30 );
equal( element.width(), 120, "unconstrained width within container" );
equal( element.height(), 130, "unconstrained height within container" );
- TestHelpers.resizable.drag( ".ui-resizable-se", 400, 400 );
+ resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "constrained width at containment edge" );
equal( element.height(), 200, "constrained height at containment edge" );
});
handles: "all"
});
- TestHelpers.resizable.drag( ".ui-resizable-e", 300, 0 );
+ resizableTestHelpers.drag( ".ui-resizable-e", 300, 0 );
equal( element.width(), 400, "Relative, contained within container width" );
- TestHelpers.resizable.drag( ".ui-resizable-s", 0, 300 );
+ resizableTestHelpers.drag( ".ui-resizable-s", 0, 300 );
equal( element.height(), 400, "Relative, contained within container height" );
$( "#child" ).css( { left: 50, top: 50 } );
handles: "all"
});
- TestHelpers.resizable.drag( ".ui-resizable-e", 400, 0 );
+ resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 300, "Relative with Left, contained within container width" );
- TestHelpers.resizable.drag( ".ui-resizable-s", 0, 400 );
+ resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 300, "Relative with Top, contained within container height" );
});
handles: "all"
});
- TestHelpers.resizable.drag( ".ui-resizable-e", 400, 0 );
+ resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 300, "Relative, contained within container width" );
- TestHelpers.resizable.drag( ".ui-resizable-s", 0, 400 );
+ resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 300, "Relative, contained within container height" );
$( "#child" ).css( { left: 50, top: 50 } );
handles: "all"
});
- TestHelpers.resizable.drag( ".ui-resizable-e", 400, 0 );
+ resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 250, "Relative with Left, contained within container width" );
- TestHelpers.resizable.drag( ".ui-resizable-s", 0, 400 );
+ resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 250, "Relative with Top, contained within container height" );
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: [ 0, 20 ] });
- TestHelpers.resizable.drag(handle, 3, 9);
+ resizableTestHelpers.drag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- TestHelpers.resizable.drag(handle, 15, 11);
+ resizableTestHelpers.drag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: 20, minWidth: 65, minHeight: 65, maxWidth: 135, maxHeight: 135 });
- TestHelpers.resizable.drag(handle, 50, 50);
+ resizableTestHelpers.drag(handle, 50, 50);
equal( target.width(), 120, "grid should respect maxWidth");
equal( target.height(), 120, "grid should respect maxHeight");
- TestHelpers.resizable.drag(handle, -100, -100);
+ resizableTestHelpers.drag(handle, -100, -100);
equal( target.width(), 80, "grid should respect minWidth");
equal( target.height(), 80, "grid should respect minHeight");
});
var handle = ".ui-resizable-se", target = $("#resizable2").resizable({ handles: "all", grid: [ 0, 20 ] });
- TestHelpers.resizable.drag(handle, 3, 9);
+ resizableTestHelpers.drag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- TestHelpers.resizable.drag(handle, 15, 11);
+ resizableTestHelpers.drag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
grid: 50
});
- TestHelpers.resizable.drag( handle, 50, 50 );
+ resizableTestHelpers.drag( handle, 50, 50 );
equal( target.width(), 50, "compare width" );
equal( target.height(), 50, "compare height" );
oldPosition = target.position();
- TestHelpers.resizable.drag( handle, 50, 50 );
+ resizableTestHelpers.drag( handle, 50, 50 );
equal( target.width(), 50, "compare width" );
equal( target.height(), 50, "compare height" );
equal( target.position().top, oldPosition.top, "compare top" );
grid: [ 50, 12 ]
});
- TestHelpers.resizable.drag( handle, 50, 50 );
+ resizableTestHelpers.drag( handle, 50, 50 );
equal( target.outerWidth(), 50, "compare width" );
equal( target.outerHeight(), 52, "compare height" );
});
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- TestHelpers.resizable.drag(handle, -50, -50);
+ resizableTestHelpers.drag(handle, -50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- TestHelpers.resizable.drag(handle, 70, 70);
+ resizableTestHelpers.drag(handle, 70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- TestHelpers.resizable.drag(handle, 50, -50);
+ resizableTestHelpers.drag(handle, 50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- TestHelpers.resizable.drag(handle, -70, 70);
+ resizableTestHelpers.drag(handle, -70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- TestHelpers.resizable.drag(handle, -50, 50);
+ resizableTestHelpers.drag(handle, -50, 50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- TestHelpers.resizable.drag(handle, 70, -70);
+ resizableTestHelpers.drag(handle, 70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- TestHelpers.resizable.drag(handle, 70, 70);
+ resizableTestHelpers.drag(handle, 70, 70);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- TestHelpers.resizable.drag(handle, -70, -70);
+ resizableTestHelpers.drag(handle, -70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = "#resizer1",
target = $( "#resizable1" ).resizable({ handles: { "s": $( "#resizer1" ) }, containment: "parent" });
- TestHelpers.resizable.drag( handle, 0, 70 );
+ resizableTestHelpers.drag( handle, 0, 70 );
equal( target.height(), 170, "compare height" );
- TestHelpers.resizable.drag( handle, 0, -70 );
+ resizableTestHelpers.drag( handle, 0, -70 );
equal( target.height(), 100, "compare height" );
});
var handle = "#resizer1",
target = $( "#resizable1" ).resizable({ handles: { "s": $( "#resizer1" )[ 0 ] }, containment: "parent" });
- TestHelpers.resizable.drag( handle, 0, 70 );
+ resizableTestHelpers.drag( handle, 0, 70 );
equal( target.height(), 170, "compare height" );
- TestHelpers.resizable.drag( handle, 0, -70 );
+ resizableTestHelpers.drag( handle, 0, -70 );
equal( target.height(), 100, "compare height" );
});
containment: "#container"
});
- TestHelpers.resizable.drag( ".ui-resizable-se", 400, 400 );
+ resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "resizable constrained width at containment edge" );
equal( element.height(), 200, "resizable constrained height at containment edge" );
equal( other.width(), 250, "alsoResize constrained width at containment edge" );
containment: "#container"
});
- TestHelpers.resizable.drag( ".ui-resizable-se", 400, 400 );
+ resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "resizable constrained width at containment edge" );
equal( element.height(), 200, "resizable constrained height at containment edge" );
equal( other1.width(), 250, "alsoResize o1 constrained width at containment edge" );
equal( other2.height(), 150, "alsoResize o2 constrained height at containment edge" );
});
-})(jQuery);
+} );