/[projects]/misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/dialog/dialog_test_helpers.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/dialog/dialog_test_helpers.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 3 months ago) by torben
File MIME type: application/javascript
File size: 1455 byte(s)
initial import
1 TestHelpers.dialog = {
2 drag: function(element, handle, dx, dy) {
3 var d = element.dialog("widget");
4 //this mouseover is to work around a limitation in resizable
5 //TODO: fix resizable so handle doesn't require mouseover in order to be used
6 $( handle, d ).simulate("mouseover").simulate( "drag", {
7 dx: dx,
8 dy: dy
9 });
10 },
11 testDrag: function(element, dx, dy, expectedDX, expectedDY, msg) {
12 var actualDX, actualDY, offsetAfter,
13 d = element.dialog("widget"),
14 handle = $(".ui-dialog-titlebar", d),
15 offsetBefore = d.offset();
16
17 TestHelpers.dialog.drag(element, handle, dx, dy);
18
19 offsetAfter = d.offset();
20
21 msg = msg ? msg + "." : "";
22
23 actualDX = offsetAfter.left - offsetBefore.left;
24 actualDY = offsetAfter.top - offsetBefore.top;
25 ok( expectedDX - actualDX <= 1 && expectedDY - actualDY <= 1, "dragged[" + expectedDX + ", " + expectedDY + "] " + msg);
26 },
27 shouldResize: function(element, dw, dh, msg) {
28 var heightAfter, widthAfter, actual, expected,
29 d = element.dialog("widget"),
30 handle = $(".ui-resizable-se", d),
31 heightBefore = d.height(),
32 widthBefore = d.width();
33
34 TestHelpers.dialog.drag(element, handle, 50, 50);
35
36 heightAfter = d.height();
37 widthAfter = d.width();
38
39 msg = msg ? msg + "." : "";
40 actual = { width: widthAfter, height: heightAfter },
41 expected = { width: widthBefore + dw, height: heightBefore + dh };
42 deepEqual(actual, expected, "resized[" + 50 + ", " + 50 + "] " + msg);
43 }
44 };

  ViewVC Help
Powered by ViewVC 1.1.20