@@ -118,8 +118,47 @@ test( "stopping the stop callback", function() {
118
118
} ) ;
119
119
120
120
ok ( element . draggable ( "instance" ) . helper , "the clone should not be deleted if the stop callback is stopped" ) ;
121
+ } ) ;
122
+
123
+ // http://bugs.jqueryui.com/ticket/6884
124
+ // Draggable: ui.offset.left differs between the "start" and "drag" hooks
125
+ test ( "position and offset in hash is consistent between start, drag, and stop" , function ( ) {
126
+ expect ( 4 ) ;
127
+
128
+ var startPos , startOffset , dragPos , dragOffset , stopPos , stopOffset ;
129
+
130
+ element = $ ( "<div style='margin: 2px;'></div>" ) . appendTo ( "#qunit-fixture" ) ;
131
+
132
+ element . draggable ( {
133
+ start : function ( event , ui ) {
134
+ startPos = ui . position ;
135
+ startOffset = ui . offset ;
136
+ } ,
137
+ drag : function ( event , ui ) {
138
+ dragPos = ui . position ;
139
+ dragOffset = ui . offset ;
140
+ } ,
141
+ stop : function ( event , ui ) {
142
+ stopPos = ui . position ;
143
+ stopOffset = ui . offset ;
144
+ }
145
+ } ) ;
146
+
147
+ element . simulate ( "drag" , {
148
+ dx : 10 ,
149
+ dy : 10 ,
150
+ moves : 1
151
+ } ) ;
121
152
153
+ startPos . left += 10 ;
154
+ startPos . top += 10 ;
155
+ startOffset . left += 10 ;
156
+ startOffset . top += 10 ;
122
157
158
+ deepEqual ( startPos , dragPos , "start position equals drag position plus distance" ) ;
159
+ deepEqual ( dragPos , stopPos , "drag position equals stop position" ) ;
160
+ deepEqual ( startOffset , dragOffset , "start offset equals drag offset plus distance" ) ;
161
+ deepEqual ( dragOffset , stopOffset , "drag offset equals stop offset" ) ;
123
162
} ) ;
124
163
125
164
} ) ( jQuery ) ;
0 commit comments