corrade-http-templates – Blame information for rev 57
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
57 | office | 1 | define( [ |
2 | "qunit", |
||
3 | "jquery", |
||
4 | "lib/helper", |
||
5 | "ui/widgets/selectable" |
||
6 | ], function( QUnit, $, testHelpers ) { |
||
7 | |||
8 | QUnit.module( "selectable: events" ); |
||
9 | |||
10 | QUnit.test( "start", function( assert ) { |
||
11 | assert.expect( 2 ); |
||
12 | var el = $( "#selectable1" ); |
||
13 | el.selectable( { |
||
14 | start: function() { |
||
15 | assert.ok( true, "drag fired start callback" ); |
||
16 | assert.equal( this, el[ 0 ], "context of callback" ); |
||
17 | } |
||
18 | } ); |
||
19 | el.simulate( "drag", { |
||
20 | dx: 20, |
||
21 | dy: 20 |
||
22 | } ); |
||
23 | } ); |
||
24 | |||
25 | QUnit.test( "stop", function( assert ) { |
||
26 | assert.expect( 2 ); |
||
27 | var el = $( "#selectable1" ); |
||
28 | el.selectable( { |
||
29 | start: function() { |
||
30 | assert.ok( true, "drag fired stop callback" ); |
||
31 | assert.equal( this, el[ 0 ], "context of callback" ); |
||
32 | } |
||
33 | } ); |
||
34 | el.simulate( "drag", { |
||
35 | dx: 20, |
||
36 | dy: 20 |
||
37 | } ); |
||
38 | } ); |
||
39 | |||
40 | QUnit.test( "mousedown: initial position of helper", function( assert ) { |
||
41 | assert.expect( 2 ); |
||
42 | |||
43 | var helperOffset, |
||
44 | element = $( "#selectable1" ).selectable(), |
||
45 | contentToForceScroll = testHelpers.forceScrollableWindow( "body" ); |
||
46 | |||
47 | $( window ).scrollTop( 100 ).scrollLeft( 100 ); |
||
48 | |||
49 | element.simulate( "mousedown", { |
||
50 | clientX: 10, |
||
51 | clientY: 10 |
||
52 | } ); |
||
53 | |||
54 | helperOffset = $( ".ui-selectable-helper" ).offset(); |
||
55 | assert.ok( helperOffset.top, 110, "Scroll top should be accounted for." ); |
||
56 | assert.ok( helperOffset.left, 110, "Scroll left should be accounted for." ); |
||
57 | |||
58 | // Cleanup |
||
59 | element.simulate( "mouseup" ); |
||
60 | contentToForceScroll.remove(); |
||
61 | $( window ).scrollTop( 0 ).scrollLeft( 0 ); |
||
62 | } ); |
||
63 | |||
64 | } ); |