aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/resizable
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-04-07 10:30:07 -0400
committerScott González <scott.gonzalez@gmail.com>2015-04-09 09:26:58 -0400
commitdc4b015a8b9acdb5bff2d5dd89737b3d8b64097f (patch)
treef2dc9ecccc32b33622aef1e597992e5a668efe56 /tests/unit/resizable
parent42566bdd037ac57cf7d6d7a5d059db2ba42518d9 (diff)
downloadjquery-ui-dc4b015a8b9acdb5bff2d5dd89737b3d8b64097f.tar.gz
jquery-ui-dc4b015a8b9acdb5bff2d5dd89737b3d8b64097f.zip
Tests: Widget test helpers extend the main helper
Ref #10119 Ref gh-1528
Diffstat (limited to 'tests/unit/resizable')
-rw-r--r--tests/unit/resizable/resizable_core.js50
-rw-r--r--tests/unit/resizable/resizable_events.js20
-rw-r--r--tests/unit/resizable/resizable_options.js102
-rw-r--r--tests/unit/resizable/resizable_test_helpers.js9
4 files changed, 92 insertions, 89 deletions
diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js
index 2e643c967..a63189511 100644
--- a/tests/unit/resizable/resizable_core.js
+++ b/tests/unit/resizable/resizable_core.js
@@ -2,7 +2,7 @@ define( [
"jquery",
"./resizable_test_helpers",
"ui/resizable"
-], function( $, resizableTestHelpers ) {
+], function( $, testHelper ) {
module("resizable: core");
@@ -30,10 +30,10 @@ test("n", function() {
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 0, -50);
+ testHelper.drag(handle, 0, -50);
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 0, 50);
+ testHelper.drag(handle, 0, 50);
equal( target.height(), 100, "compare height" );
equal( target[0].style.left, "", "left should not be modified" );
@@ -45,10 +45,10 @@ test("s", function() {
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 0, 50);
+ testHelper.drag(handle, 0, 50);
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 0, -50);
+ testHelper.drag(handle, 0, -50);
equal( target.height(), 100, "compare height" );
equal( target[0].style.top, "", "top should not be modified" );
@@ -61,10 +61,10 @@ test("e", function() {
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 50);
+ testHelper.drag(handle, 50);
equal( target.width(), 150, "compare width");
- resizableTestHelpers.drag(handle, -50);
+ testHelper.drag(handle, -50);
equal( target.width(), 100, "compare width" );
equal( target[0].style.height, "", "height should not be modified" );
@@ -77,10 +77,10 @@ test("w", function() {
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50);
+ testHelper.drag(handle, -50);
equal( target.width(), 150, "compare width" );
- resizableTestHelpers.drag(handle, 50);
+ testHelper.drag(handle, 50);
equal( target.width(), 100, "compare width" );
equal( target[0].style.height, "", "height should not be modified" );
@@ -92,11 +92,11 @@ test("ne", function() {
var handle = ".ui-resizable-ne", target = $("#resizable1").css({ overflow: "hidden" }).resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 50, "compare width" );
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
@@ -108,11 +108,11 @@ test("se", function() {
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
@@ -125,11 +125,11 @@ test("sw", function() {
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 50, "compare height" );
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
@@ -141,11 +141,11 @@ test("nw", function() {
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
@@ -163,10 +163,10 @@ test("handle with complex markup (#8756)", function() {
var handle = ".ui-resizable-w div", target = $("#resizable1").resizable({ handles: "all" });
- resizableTestHelpers.drag(handle, -50);
+ testHelper.drag(handle, -50);
equal( target.width(), 150, "compare width" );
- resizableTestHelpers.drag(handle, 50);
+ testHelper.drag(handle, 50);
equal( target.width(), 100, "compare width" );
});
@@ -186,7 +186,7 @@ test("resizable accounts for scroll position correctly (#3815)", function() {
left = el.css("left");
top = el.css("top");
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.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" );
@@ -203,7 +203,7 @@ test( "resizable stores correct size when using helper and grid (#9547)", functi
grid: [ 10, 10 ]
});
- resizableTestHelpers.drag( handle, 1, 1 );
+ testHelper.drag( handle, 1, 1 );
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
@@ -227,14 +227,14 @@ test( "nested resizable", function() {
innerHandle = $( "#inner > .ui-resizable-e" );
outerHandle = $( "#outer > .ui-resizable-e" );
- resizableTestHelpers.drag( innerHandle, 10 );
+ testHelper.drag( innerHandle, 10 );
equal( inner.width(), 40, "compare width of inner element" );
- resizableTestHelpers.drag( innerHandle, -10 );
+ testHelper.drag( innerHandle, -10 );
equal( inner.width(), 30, "compare width of inner element" );
- resizableTestHelpers.drag( outerHandle, 10 );
+ testHelper.drag( outerHandle, 10 );
equal( outer.width(), 60, "compare width of outer element" );
- resizableTestHelpers.drag( outerHandle, -10 );
+ testHelper.drag( outerHandle, -10 );
equal( outer.width(), 50, "compare width of outer element" );
inner.remove();
diff --git a/tests/unit/resizable/resizable_events.js b/tests/unit/resizable/resizable_events.js
index 62f258239..a26824137 100644
--- a/tests/unit/resizable/resizable_events.js
+++ b/tests/unit/resizable/resizable_events.js
@@ -2,7 +2,7 @@ define( [
"jquery",
"./resizable_test_helpers",
"ui/resizable"
-], function( $, resizableTestHelpers ) {
+], function( $, testHelper ) {
module("resizable: events");
@@ -24,7 +24,7 @@ test("start", function() {
}
});
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal(count, 1, "start callback should happen exactly once");
@@ -55,7 +55,7 @@ test( "resize", function() {
}
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( count, 2, "resize callback should happen exactly once per size adjustment" );
@@ -83,7 +83,7 @@ test( "resize (min/max dimensions)", function() {
}
});
- resizableTestHelpers.drag( handle, -200, -200 );
+ testHelper.drag( handle, -200, -200 );
equal( count, 1, "resize callback should happen exactly once per size adjustment" );
@@ -113,10 +113,10 @@ test( "resize (containment)", function() {
});
// Prove you can't resize outside containment by dragging southeast corner southeast
- resizableTestHelpers.drag( handle, 100, 100 );
+ testHelper.drag( handle, 100, 100 );
// Prove you can't resize outside containment by dragging southeast corner northwest
- resizableTestHelpers.drag( handle, -200, -200 );
+ testHelper.drag( handle, -200, -200 );
equal( count, 1, "resize callback should happen exactly once per size adjustment" );
@@ -141,7 +141,7 @@ test("resize (grid)", function() {
}
});
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal(count, 1, "resize callback should happen exactly once per grid-unit size adjustment");
@@ -160,7 +160,7 @@ test( "resize, custom adjustment", function() {
}
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( element.width(), 100, "resize event can control width" );
equal( element.height(), 200, "resize event can control height" );
@@ -186,7 +186,7 @@ test("stop", function() {
}
});
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal(count, 1, "stop callback should happen exactly once");
@@ -231,7 +231,7 @@ test( "resize (containment) works with parent with negative offset", function()
widthBefore = target.width();
- resizableTestHelpers.drag( handle, increaseWidthBy, 0 );
+ testHelper.drag( handle, increaseWidthBy, 0 );
widthAfter = target.width();
diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js
index c296fe38c..bf9033f13 100644
--- a/tests/unit/resizable/resizable_options.js
+++ b/tests/unit/resizable/resizable_options.js
@@ -2,7 +2,7 @@ define( [
"jquery",
"./resizable_test_helpers",
"ui/resizable"
-], function( $, resizableTestHelpers ) {
+], function( $, testHelper ) {
module("resizable: options");
@@ -20,7 +20,7 @@ test( "alsoResize", function() {
}),
handle = ".ui-resizable-e";
- resizableTestHelpers.drag( handle, 80 );
+ testHelper.drag( handle, 80 );
equal( element.width(), 180, "resizable width" );
equal( other.width(), 130, "alsoResize width" );
});
@@ -30,11 +30,11 @@ test("aspectRatio: 'preserve' (e)", function() {
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 80);
+ testHelper.drag(handle, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, -130);
+ testHelper.drag(handle, -130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -44,11 +44,11 @@ test("aspectRatio: 'preserve' (w)", function() {
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, -80);
+ testHelper.drag(handle, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 130);
+ testHelper.drag(handle, 130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -58,11 +58,11 @@ test("aspectRatio: 'preserve' (n)", function() {
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 0, -80);
+ testHelper.drag(handle, 0, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 0, 80);
+ testHelper.drag(handle, 0, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -72,11 +72,11 @@ test("aspectRatio: 'preserve' (s)", function() {
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 0, 80);
+ testHelper.drag(handle, 0, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 0, -80);
+ testHelper.drag(handle, 0, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -86,11 +86,11 @@ test("aspectRatio: 'preserve' (se)", function() {
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 80, 80);
+ testHelper.drag(handle, 80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, -80, -80);
+ testHelper.drag(handle, -80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -100,11 +100,11 @@ test("aspectRatio: 'preserve' (sw)", function() {
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, -80, 80);
+ testHelper.drag(handle, -80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, 80, -80);
+ testHelper.drag(handle, 80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -114,11 +114,11 @@ test("aspectRatio: 'preserve' (ne)", function() {
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ aspectRatio: "preserve", handles: "all", minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- resizableTestHelpers.drag(handle, 80, -80);
+ testHelper.drag(handle, 80, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- resizableTestHelpers.drag(handle, -80, 80);
+ testHelper.drag(handle, -80, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -138,7 +138,7 @@ test( "aspectRatio: Resizing can move objects", function() {
$( "#container" ).css({ width: 200, height: 300 });
$( "#resizable1" ).css({ width: 100, height: 100, left: 75, top: 200 });
- resizableTestHelpers.drag( handleW, -20 );
+ testHelper.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" );
@@ -147,7 +147,7 @@ test( "aspectRatio: Resizing can move objects", function() {
$( "#container" ).css({ width: 200, height: 300, position: "absolute", left: 100, top: 100 });
$( "#resizable1" ).css({ width: 100, height: 100, left: 0, top: 0 });
- resizableTestHelpers.drag( handleNW, -20, -20 );
+ testHelper.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" );
@@ -161,11 +161,11 @@ test( "containment", function() {
containment: "#container"
});
- resizableTestHelpers.drag( ".ui-resizable-se", 20, 30 );
+ testHelper.drag( ".ui-resizable-se", 20, 30 );
equal( element.width(), 120, "unconstrained width within container" );
equal( element.height(), 130, "unconstrained height within container" );
- resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
+ testHelper.drag( ".ui-resizable-se", 400, 400 );
equal( element.width(), 300, "constrained width at containment edge" );
equal( element.height(), 200, "constrained height at containment edge" );
});
@@ -180,10 +180,10 @@ test( "containment - not immediate parent", function() {
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 300, 0 );
+ testHelper.drag( ".ui-resizable-e", 300, 0 );
equal( element.width(), 400, "Relative, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 300 );
+ testHelper.drag( ".ui-resizable-s", 0, 300 );
equal( element.height(), 400, "Relative, contained within container height" );
$( "#child" ).css( { left: 50, top: 50 } );
@@ -195,10 +195,10 @@ test( "containment - not immediate parent", function() {
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
+ testHelper.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 300, "Relative with Left, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
+ testHelper.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 300, "Relative with Top, contained within container height" );
});
@@ -212,10 +212,10 @@ test( "containment - immediate parent", function() {
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
+ testHelper.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 300, "Relative, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
+ testHelper.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 300, "Relative, contained within container height" );
$( "#child" ).css( { left: 50, top: 50 } );
@@ -227,10 +227,10 @@ test( "containment - immediate parent", function() {
handles: "all"
});
- resizableTestHelpers.drag( ".ui-resizable-e", 400, 0 );
+ testHelper.drag( ".ui-resizable-e", 400, 0 );
equal( element.width(), 250, "Relative with Left, contained within container width" );
- resizableTestHelpers.drag( ".ui-resizable-s", 0, 400 );
+ testHelper.drag( ".ui-resizable-s", 0, 400 );
equal( element.height(), 250, "Relative with Top, contained within container height" );
});
@@ -239,11 +239,11 @@ test("grid", function() {
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: [ 0, 20 ] });
- resizableTestHelpers.drag(handle, 3, 9);
+ testHelper.drag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- resizableTestHelpers.drag(handle, 15, 11);
+ testHelper.drag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
@@ -253,11 +253,11 @@ test("grid (min/max dimensions)", function() {
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: 20, minWidth: 65, minHeight: 65, maxWidth: 135, maxHeight: 135 });
- resizableTestHelpers.drag(handle, 50, 50);
+ testHelper.drag(handle, 50, 50);
equal( target.width(), 120, "grid should respect maxWidth");
equal( target.height(), 120, "grid should respect maxHeight");
- resizableTestHelpers.drag(handle, -100, -100);
+ testHelper.drag(handle, -100, -100);
equal( target.width(), 80, "grid should respect minWidth");
equal( target.height(), 80, "grid should respect minHeight");
});
@@ -267,11 +267,11 @@ test("grid (wrapped)", function() {
var handle = ".ui-resizable-se", target = $("#resizable2").resizable({ handles: "all", grid: [ 0, 20 ] });
- resizableTestHelpers.drag(handle, 3, 9);
+ testHelper.drag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- resizableTestHelpers.drag(handle, 15, 11);
+ testHelper.drag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
@@ -286,13 +286,13 @@ test( "grid - Resizable: can be moved when grid option is set (#9611)", function
grid: 50
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( target.width(), 50, "compare width" );
equal( target.height(), 50, "compare height" );
oldPosition = target.position();
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( target.width(), 50, "compare width" );
equal( target.height(), 50, "compare height" );
equal( target.position().top, oldPosition.top, "compare top" );
@@ -314,7 +314,7 @@ test( "grid - maintains grid with padding and border when approaching no dimensi
grid: [ 50, 12 ]
});
- resizableTestHelpers.drag( handle, 50, 50 );
+ testHelper.drag( handle, 50, 50 );
equal( target.outerWidth(), 50, "compare width" );
equal( target.outerHeight(), 52, "compare height" );
});
@@ -324,11 +324,11 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, -50, -50);
+ testHelper.drag(handle, -50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, 70, 70);
+ testHelper.drag(handle, 70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -338,11 +338,11 @@ test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, 50, -50);
+ testHelper.drag(handle, 50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, -70, 70);
+ testHelper.drag(handle, -70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -352,11 +352,11 @@ test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
var handle = ".ui-resizable-ne", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, -50, 50);
+ testHelper.drag(handle, -50, 50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, 70, -70);
+ testHelper.drag(handle, 70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -366,11 +366,11 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all", minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- resizableTestHelpers.drag(handle, 70, 70);
+ testHelper.drag(handle, 70, 70);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- resizableTestHelpers.drag(handle, -70, -70);
+ testHelper.drag(handle, -70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -382,10 +382,10 @@ test( "custom handles { handles: { 's': $('#resizer1'), containment: 'parent' }"
var handle = "#resizer1",
target = $( "#resizable1" ).resizable({ handles: { "s": $( "#resizer1" ) }, containment: "parent" });
- resizableTestHelpers.drag( handle, 0, 70 );
+ testHelper.drag( handle, 0, 70 );
equal( target.height(), 170, "compare height" );
- resizableTestHelpers.drag( handle, 0, -70 );
+ testHelper.drag( handle, 0, -70 );
equal( target.height(), 100, "compare height" );
});
@@ -396,10 +396,10 @@ test( "custom handles { handles: { 's': $('#resizer1')[0], containment: 'parent'
var handle = "#resizer1",
target = $( "#resizable1" ).resizable({ handles: { "s": $( "#resizer1" )[ 0 ] }, containment: "parent" });
- resizableTestHelpers.drag( handle, 0, 70 );
+ testHelper.drag( handle, 0, 70 );
equal( target.height(), 170, "compare height" );
- resizableTestHelpers.drag( handle, 0, -70 );
+ testHelper.drag( handle, 0, -70 );
equal( target.height(), 100, "compare height" );
});
@@ -426,7 +426,7 @@ test( "alsoResize + containment", function() {
containment: "#container"
});
- resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
+ testHelper.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" );
@@ -454,7 +454,7 @@ test( "alsoResize + multiple selection", function() {
containment: "#container"
});
- resizableTestHelpers.drag( ".ui-resizable-se", 400, 400 );
+ testHelper.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" );
diff --git a/tests/unit/resizable/resizable_test_helpers.js b/tests/unit/resizable/resizable_test_helpers.js
index 1c2ec831b..494c1a073 100644
--- a/tests/unit/resizable/resizable_test_helpers.js
+++ b/tests/unit/resizable/resizable_test_helpers.js
@@ -1,6 +1,9 @@
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
drag: function( el, dx, dy ) {
// this mouseover is to work around a limitation in resizable
// TODO: fix resizable so handle doesn't require mouseover in order to be used
@@ -10,6 +13,6 @@ return {
dy: dy
});
}
-};
+} );
} );