@@ -89,11 +89,60 @@ test( "hoverClass", function() {
8989test( "tolerance, fit", function() {
9090 ok(false, 'missing test - untested code is broken code');
9191});
92+ */
9293
9394test ( "tolerance, intersect" , function ( ) {
94- ok(false, 'missing test - untested code is broken code');
95+ expect ( 2 ) ;
96+
97+ var draggable , droppable ,
98+ dataset = [
99+ [ 0 , 0 , false , "too far up and left" ] ,
100+ [ 6 , 0 , false , "too far up" ] ,
101+ [ 0 , 6 , false , "too far left" ] ,
102+ [ 6 , 6 , true , "top left corner" ] ,
103+ [ 14 , 14 , true , "bottom right corner" ] ,
104+ [ 15 , 6 , false , "too far right" ] ,
105+ [ 6 , 15 , false , "too far down" ] ,
106+ [ 15 , 15 , false , "too far down and right" ]
107+ ] ;
108+
109+ draggable = $ ( "<div />" )
110+ . appendTo ( "#qunit-fixture" )
111+ . css ( {
112+ width : 10 ,
113+ height : 10 ,
114+ position : "absolute" ,
115+
116+ // http://bugs.jqueryui.com/ticket/6876
117+ // Droppable: droppable region is offset by draggables margin
118+ marginTop : 3 ,
119+ marginLeft : 3
120+ } )
121+ . draggable ( ) ;
122+
123+ droppable = $ ( "<div />" )
124+ . appendTo ( "#qunit-fixture" )
125+ . css ( { width : 10 , height : 10 , position : "absolute" , top : 13 , left : 13 } )
126+ . droppable ( { tolerance : "intersect" } ) ;
127+
128+ $ . each ( dataset , function ( ) {
129+ var data = this ;
130+
131+ draggable . css ( {
132+ top : 0 ,
133+ left : 0
134+ } ) ;
135+
136+ droppable . unbind ( "drop" ) . bind ( "drop" , function ( ) {
137+ equal ( true , data [ 2 ] , data [ 3 ] ) ;
138+ } ) ;
139+
140+ $ ( draggable ) . simulate ( "drag" , {
141+ dx : data [ 0 ] ,
142+ dy : data [ 1 ]
143+ } ) ;
144+ } ) ;
95145} ) ;
96- */
97146
98147test ( "tolerance, pointer" , function ( ) {
99148 expect ( 3 ) ;
0 commit comments