@@ -38,27 +38,30 @@ test( "stop", function() {
38
38
test ( "mousedown: initial position of helper" , function ( ) {
39
39
expect ( 2 ) ;
40
40
41
- var contentToForceScroll , helper ,
42
- element = $ ( "#selectable1" ) . selectable ( ) ;
41
+ var helperOffset ,
42
+ element = $ ( "#selectable1" ) . selectable ( ) ,
43
+ contentToForceScroll = $ ( "<div>" ) . css ( {
44
+ height : "10000px" ,
45
+ width : "10000px"
46
+ } ) ;
43
47
44
- contentToForceScroll = $ ( "<div>" ) . css ( {
45
- height : "10000px" ,
46
- width : "10000px"
47
- } ) ;
48
+ contentToForceScroll . appendTo ( "body" ) ;
49
+ $ ( window ) . scrollTop ( 100 ) . scrollLeft ( 100 ) ;
48
50
49
- contentToForceScroll . appendTo ( "body" ) ;
50
- $ ( window ) . scrollTop ( 1 ) . scrollLeft ( 1 ) ;
51
51
element . simulate ( "mousedown" , {
52
52
clientX : 10 ,
53
53
clientY : 10
54
54
} ) ;
55
55
56
- helper = $ ( ".ui-selectable-helper" ) ;
57
- equal ( helper . css ( "top" ) , "11px" , "Scroll top should be accounted for." ) ;
58
- equal ( helper . css ( "left" ) , "11px" , "Scroll left should be accounted for." ) ;
56
+ // we do a GTE comparison here because IE7 erroneously subtracts
57
+ // 2 pixels from a simulated mousedown for clientX/Y
58
+ // Support: IE7
59
+ helperOffset = $ ( ".ui-selectable-helper" ) . offset ( ) ;
60
+ ok ( helperOffset . top >= 99 , "Scroll top should be accounted for." ) ;
61
+ ok ( helperOffset . left >= 99 , "Scroll left should be accounted for." ) ;
59
62
60
63
// Cleanup
61
- element . simulate ( "mouseup" ) ;
64
+ element . simulate ( "mouseup" ) ;
62
65
contentToForceScroll . remove ( ) ;
63
66
$ ( window ) . scrollTop ( 0 ) . scrollLeft ( 0 ) ;
64
67
} ) ;
0 commit comments