diff options
Diffstat (limited to 'ui/tests/resizable.js')
-rw-r--r-- | ui/tests/resizable.js | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/ui/tests/resizable.js b/ui/tests/resizable.js index 9fe4d4a0d..12f9c4728 100644 --- a/ui/tests/resizable.js +++ b/ui/tests/resizable.js @@ -3,7 +3,7 @@ var drag = function(el, dx, dy, complete) { // speed = sync -> Drag syncrhonously. // speed = fast|slow -> Drag asyncrhonously - animated. - return $(el).userAction("drag", { + return $(el).simulate("drag", { dx: dx||0, dy: dy||0, speed: 'sync', complete: complete }); }; @@ -18,11 +18,11 @@ test("ui-resizable-e resize x", function() { drag(handle, 50); - equals( 149, target.width(), "compare width"); + equals( target.width(), 150, "compare width"); drag(handle, -50); - equals( 100, target.width(), "compare width" ); + equals( target.width(), 100, "compare width" ); }); @@ -34,11 +34,11 @@ test("ui-resizable-w resize x", function() { drag(handle, -50); - equals( 149, target.width(), "compare width" ); + equals( target.width(), 150, "compare width" ); drag(handle, 50); - equals( 100, target.width(), "compare width" ); + equals( target.width(), 100, "compare width" ); }); @@ -50,11 +50,11 @@ test("ui-resizable-n resize y", function() { drag(handle, 0, -50); - equals( 149, target.height(), "compare height" ); + equals( target.height(), 150, "compare height" ); drag(handle, 0, 50); - equals( 100, target.height(), "compare height" ); + equals( target.height(), 100, "compare height" ); }); @@ -66,11 +66,11 @@ test("ui-resizable-s resize y", function() { drag(handle, 0, 50); - equals( 149, target.height(), "compare height" ); + equals( target.height(), 150, "compare height" ); drag(handle, 0, -50); - equals( 100, target.height(), "compare height" ); + equals( target.height(), 100, "compare height" ); }); @@ -82,13 +82,13 @@ test("ui-resizable-se resize xy", function() { drag(handle, 50, 50); - equals( 149, target.width(), "compare width" ); - equals( 149, target.height(), "compare height" ); + equals( target.width(), 150, "compare width" ); + equals( target.height(), 150, "compare height" ); drag(handle, -50, -50); - equals( 100, target.width(), "compare width" ); - equals( 100, target.height(), "compare height" ); + equals( target.width(), 100, "compare width" ); + equals( target.height(), 100, "compare height" ); }); @@ -100,13 +100,13 @@ test("ui-resizable-sw resize xy", function() { drag(handle, -50, -50); - equals( 149, target.width(), "compare width" ); - equals( 51, target.height(), "compare height" ); + equals( target.width(), 150, "compare width" ); + equals( target.height(), 50, "compare height" ); drag(handle, 50, 50); - equals( 100, target.width(), "compare width" ); - equals( 100, target.height(), "compare height" ); + equals( target.width(), 100, "compare width" ); + equals( target.height(), 100, "compare height" ); }); @@ -118,13 +118,13 @@ test("ui-resizable-ne resize xy", function() { drag(handle, -50, -50); - equals( 51, target.width(), "compare width" ); - equals( 149, target.height(), "compare height" ); + equals( target.width(), 50, "compare width" ); + equals( target.height(), 150, "compare height" ); drag(handle, 50, 50); - equals( 100, target.width(), "compare width" ); - equals( 100, target.height(), "compare height" ); + equals( target.width(), 100, "compare width" ); + equals( target.height(), 100, "compare height" ); }); @@ -136,13 +136,13 @@ test("ui-resizable-nw resize xy", function() { drag(handle, -50, -50); - equals( 149, target.width(), "compare width" ); - equals( 149, target.height(), "compare height" ); + equals( target.width(), 150, "compare width" ); + equals( target.height(), 150, "compare height" ); drag(handle, 50, 50); - equals( 100, target.width(), "compare width" ); - equals( 100, target.height(), "compare height" ); + equals( target.width(), 100, "compare width" ); + equals( target.height(), 100, "compare height" ); }); @@ -161,13 +161,13 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 drag(handle, -50, -50); - equals( 60, target.width(), "compare minWidth" ); - equals( 60, target.height(), "compare minHeight" ); + equals( target.width(), 60, "compare minWidth" ); + equals( target.height(), 60, "compare minHeight" ); drag(handle, 70, 70); - equals( 100, target.width(), "compare maxWidth" ); - equals( 100, target.height(), "compare maxHeight" ); + equals( target.width(), 100, "compare maxWidth" ); + equals( target.height(), 100, "compare maxHeight" ); }); @@ -179,13 +179,13 @@ test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 drag(handle, 50, -50); - equals( 60, target.width(), "compare minWidth" ); - equals( 60, target.height(), "compare minHeight" ); + equals( target.width(), 60, "compare minWidth" ); + equals( target.height(), 60, "compare minHeight" ); drag(handle, -70, 70); - equals( 100, target.width(), "compare maxWidth" ); - equals( 100, target.height(), "compare maxHeight" ); + equals( target.width(), 100, "compare maxWidth" ); + equals( target.height(), 100, "compare maxHeight" ); }); @@ -197,13 +197,13 @@ test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 drag(handle, -50, 50); - equals( 60, target.width(), "compare minWidth" ); - equals( 60, target.height(), "compare minHeight" ); + equals( target.width(), 60, "compare minWidth" ); + equals( target.height(), 60, "compare minHeight" ); drag(handle, 70, -70); - equals( 100, target.width(), "compare maxWidth" ); - equals( 100, target.height(), "compare maxHeight" ); + equals( target.width(), 100, "compare maxWidth" ); + equals( target.height(), 100, "compare maxHeight" ); }); @@ -215,13 +215,13 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 drag(handle, 70, 70); - equals( 60, target.width(), "compare minWidth" ); - equals( 60, target.height(), "compare minHeight" ); + equals( target.width(), 60, "compare minWidth" ); + equals( target.height(), 60, "compare minHeight" ); drag(handle, -70, -70); - equals( 100, target.width(), "compare maxWidth" ); - equals( 100, target.height(), "compare maxHeight" ); + equals( target.width(), 100, "compare maxWidth" ); + equals( target.height(), 100, "compare maxHeight" ); }); @@ -239,13 +239,13 @@ test("ui-resizable-e { aspectRatio: 'preserve', handles: 'all', minWidth: 70, mi drag(handle, 80); - equals( 150, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); drag(handle, -130); - equals( 70, target.width(), "compare minWidth"); - equals( 70, target.height(), "compare minHeight"); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); }); @@ -257,13 +257,13 @@ test("ui-resizable-w { aspectRatio: 'preserve', handles: 'all', minWidth: 70, mi drag(handle, -80); - equals( 150, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); drag(handle, 130); - equals( 70, target.width(), "compare minWidth"); - equals( 70, target.height(), "compare minHeight"); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); }); @@ -275,14 +275,14 @@ test("ui-resizable-n { aspectRatio: 'preserve', handles: 'all', minWidth: 70, mi drag(handle, 0, -80); - equals( 130, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); - drag(handle, 0, 130); - - equals( 70, target.width(), "compare minWidth"); - equals( 50, target.height(), "compare minHeight"); + drag(handle, 0, 80); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); + }); test("ui-resizable-s { aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }", function() { @@ -293,13 +293,13 @@ test("ui-resizable-s { aspectRatio: 'preserve', handles: 'all', minWidth: 70, mi drag(handle, 0, 80); - equals( 130, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); - drag(handle, 0, -130); + drag(handle, 0, -80); - equals( 70, target.width(), "compare minWidth"); - equals( 50, target.height(), "compare minHeight"); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); }); @@ -311,13 +311,13 @@ test("ui-resizable-se { aspectRatio: 'preserve', handles: 'all', minWidth: 70, m drag(handle, 80, 80); - equals( 130, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); - drag(handle, -130, -130); + drag(handle, -80, -80); - equals( 70, target.width(), "compare minWidth"); - equals( 50, target.height(), "compare minHeight"); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); }); @@ -329,13 +329,13 @@ test("ui-resizable-sw { aspectRatio: 'preserve', handles: 'all', minWidth: 70, m drag(handle, -80, 80); - equals( 130, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); - drag(handle, 130, -130); + drag(handle, 80, -80); - equals( 70, target.width(), "compare minWidth"); - equals( 50, target.height(), "compare minHeight"); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); }); @@ -347,33 +347,33 @@ test("ui-resizable-ne { aspectRatio: 'preserve', handles: 'all', minWidth: 70, m drag(handle, 80, -80); - equals( 130, target.width(), "compare maxWidth"); - equals( 130, target.height(), "compare maxHeight"); + equals( target.width(), 130, "compare maxWidth"); + equals( target.height(), 130, "compare maxHeight"); - drag(handle, -130, 130); + drag(handle, -80, 80); - equals( 70, target.width(), "compare minWidth"); - equals( 50, target.height(), "compare minHeight"); + equals( target.width(), 70, "compare minWidth"); + equals( target.height(), 70, "compare minHeight"); }); module("Options"); -test("ui-resizable-se { handles: 'all', gird: [0, 20] }", function() { +test("ui-resizable-se { handles: 'all', grid: [0, 20] }", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] }); expect(4); - drag(handle, 10, 10); + drag(handle, 3, 9); - equals( 109, target.width(), "compare width"); - equals( 100, target.height(), "compare height"); + equals( target.width(), 103, "compare width"); + equals( target.height(), 100, "compare height"); - drag(handle, 30, 30); + drag(handle, 15, 11); - equals( 138, target.width(), "compare width"); - equals( 120, target.height(), "compare height"); + equals( target.width(), 118, "compare width"); + equals( target.height(), 120, "compare height"); }); |