Selaa lähdekoodia

fix overlap tests

Adam Shaw 8 vuotta sitten
vanhempi
sitoutus
be98ca2a2f
2 muutettua tiedostoa jossa 19 lisäystä ja 8 poistoa
  1. 6 6
      tests/legacy/overlap.js
  2. 13 2
      tests/lib/dnd-resize-utils.js

+ 6 - 6
tests/legacy/overlap.js

@@ -402,10 +402,10 @@ describe('event overlap', function() {
 							} ]
 						},
 						{
-							overlap: function(otherEvent, thisEvent) {
+							overlap: function(stillEvent, draggingEvent) {
 								// checks that the arguments are correct
-								expect(otherEvent.title).toBe('Event A');
-								expect(thisEvent.title).toBe('Event B');
+								expect(stillEvent.title).toBe('Event B');
+								expect(draggingEvent.title).toBe('Event A');
 								return false;
 							},
 							events: [ {
@@ -548,10 +548,10 @@ describe('event overlap', function() {
 				it('does not allow dragging', function(done) {
 					options.eventSources = [
 						{
-							overlap: function(otherEvent, thisEvent) {
+							overlap: function(stillEvent, draggingEvent) {
 								// checking parameters here
-								expect(otherEvent.title).toBe('Event B');
-								expect(thisEvent.title).toBe('Event A');
+								expect(stillEvent.title).toBe('Event B');
+								expect(draggingEvent.title).toBe('Event A');
 								return false;
 							},
 							events: [ {

+ 13 - 2
tests/lib/dnd-resize-utils.js

@@ -133,8 +133,19 @@ function testEventResize(options, resizeDate, expectSuccess, callback, eventClas
 				allowed = !$('body').hasClass('fc-not-allowed');
 			},
 			onRelease: function() {
-				var eventObj = calendar.clientEvents()[0];
-				var successfulDrop = eventObj.end && eventObj.end.format() === resizeDate.format();
+				var eventObj;
+				var successfulDrop;
+
+				if (eventClassName) {
+					eventObj = calendar.clientEvents(function(o) {
+						return o.className.join(' ') === eventClassName;
+					})[0];
+				}
+				else {
+					eventObj = calendar.clientEvents()[0];
+				}
+
+				successfulDrop = eventObj.end && eventObj.end.format() === resizeDate.format();
 
 				expect(allowed).toBe(successfulDrop);
 				expect(allowed).toBe(expectSuccess);