Adam Shaw 8 лет назад
Родитель
Сommit
1428301311

+ 2 - 0
tests/event-drag/DayGridEventDragUtils.js

@@ -1,3 +1,5 @@
+import * as EventDragUtils from './EventDragUtils';
+
 
 export function drag(startDate, endDate, debug) {
 	var el0 = DayGridRenderUtils.getSingleDayEl(startDate);

+ 31 - 37
tests/event-drag/EventDragUtils.js

@@ -2,44 +2,38 @@ import { getRectCenter, intersectRects } from '../lib/geom';
 
 /*
 TODO: Don't rely on legacy simulateDrag
+Given the rectangles of the origin and destination
+slot or day area.
 */
-var EventDragUtils = {
-
-	/*
-	Given the rectangles of the origin and destination
-	slot or day area.
-	*/
-	drag: function(rect0, rect1, debug) {
-		var el = EventRenderUtils.getSingleEl();
-		var elRect = el[0].getBoundingClientRect();
-		var point0 = getRectCenter(
-			intersectRects(elRect, rect0)
-		);
-		var point1 = getRectCenter(rect1);
-		var deferred = $.Deferred();
-
-		el.simulate('drag', {
-			point: point0,
-			end: point1,
-			debug: debug
-		});
-
-		currentCalendar.on('eventDragStop', function() {
-			setTimeout(function() {
-				deferred.resolve({ isSuccess: false }); // won't do anything if already eventDrop
-			}, 200);  // will happen after eventDrop's timeout
-		});
-
-		currentCalendar.on('eventDrop', function(event) { // always called after eventDragStop, if success
-			setTimeout(function() {
-				deferred.resolve({ isSuccess: true, event: event });
-			}, 100); // will happen first
-		});
-
-		return deferred.promise();
-	}
-
-};
+export function drag(rect0, rect1, debug) {
+	var el = EventRenderUtils.getSingleEl();
+	var elRect = el[0].getBoundingClientRect();
+	var point0 = getRectCenter(
+		intersectRects(elRect, rect0)
+	);
+	var point1 = getRectCenter(rect1);
+	var deferred = $.Deferred();
+
+	el.simulate('drag', {
+		point: point0,
+		end: point1,
+		debug: debug
+	});
+
+	currentCalendar.on('eventDragStop', function() {
+		setTimeout(function() {
+			deferred.resolve({ isSuccess: false }); // won't do anything if already eventDrop
+		}, 200);  // will happen after eventDrop's timeout
+	});
+
+	currentCalendar.on('eventDrop', function(event) { // always called after eventDragStop, if success
+		setTimeout(function() {
+			deferred.resolve({ isSuccess: true, event: event });
+		}, 100); // will happen first
+	});
+
+	return deferred.promise();
+}
 
 // makes the setTimeout's work.
 // also makes the tests faster.

+ 2 - 0
tests/event-drag/TimeGridEventDragUtils.js

@@ -1,3 +1,5 @@
+import * as EventDragUtils from './EventDragUtils';
+
 
 export function drag(startDate, endDate, debug) {
 

+ 1 - 0
tests/event-drag/repeating.js

@@ -1,3 +1,4 @@
+import * as EventDragUtils from './EventDragUtils';
 import * as TimeGridEventDragUtils from './TimeGridEventDragUtils';
 
 describe('event dragging on repeating events', function() {

+ 1 - 0
tests/event-drag/showNonCurrentDates.js

@@ -1,3 +1,4 @@
+import * as EventDragUtils from './EventDragUtils';
 import * as DayGridEventDragUtils from './DayGridEventDragUtils';
 
 describe('showNonCurrentDates event dragging', function() {

+ 2 - 0
tests/event-drag/validRange.js

@@ -1,5 +1,7 @@
+import * as EventDragUtils from './EventDragUtils';
 import * as DayGridEventDragUtils from './DayGridEventDragUtils';
 
+
 describe('validRange event dragging', function() {
 
 	describe('when start constraint', function() {