Browse Source

bug where unrelated repeating events dont hide

Adam Shaw 8 years ago
parent
commit
a911074391
2 changed files with 41 additions and 18 deletions
  1. 1 1
      src/common/View.js
  2. 40 17
      tests/event-drag/repeating.js

+ 1 - 1
src/common/View.js

@@ -702,7 +702,7 @@ var View = FC.View = ChronoComponent.extend({
 		var i;
 
 		for (i = 0; i < segs.length; i++) {
-			if (!event || segs[i].event._id === event._id) {
+			if (!event || segs[i].event.id === event.id) {
 				if (segs[i].el) {
 					func.call(this, segs[i]);
 				}

+ 40 - 17
tests/event-drag/repeating.js

@@ -1,26 +1,27 @@
 
 describe('event dragging on repeating events', function() {
+	pushOptions({
+		defaultView: 'month',
+		defaultDate: '2017-02-12',
+		editable: true,
+		events: [
+			{
+				id: 999,
+				title: 'Repeating Event',
+				start: '2017-02-09T16:00:00'
+			},
+			{
+				id: 999,
+				title: 'Repeating Event',
+				start: '2017-02-16T16:00:00'
+			}
+		]
+	});
 
 	// bug where offscreen instance of a repeating event was being incorrectly dragged
 	pit('drags correct instance of event', function() {
 
-		initCalendar({
-			defaultView: 'month',
-			defaultDate: '2017-02-12',
-			editable: true,
-			events: [
-				{
-					id: 999,
-					title: 'Repeating Event',
-					start: '2017-02-09T16:00:00'
-				},
-				{
-					id: 999,
-					title: 'Repeating Event',
-					start: '2017-02-16T16:00:00'
-				}
-			]
-		});
+		initCalendar();
 
 		// event range needs out large (month) then scope down (agendaWeek)
 		// so that the new view receives out-of-range events.
@@ -32,4 +33,26 @@ describe('event dragging on repeating events', function() {
 			});
 	});
 
+	it('hides other repeating events when dragging', function(done) {
+
+		initCalendar({
+			eventDragStart: function() {
+				setTimeout(function() { // try go execute DURING the drag
+					expect(
+						$('.fc-event:visible').filter(function(i, node) {
+							return $(node).css('visibility') !== 'hidden';
+						}).length
+					).toBe(1);
+				});
+			},
+			eventDrop: function() {
+				done();
+			}
+		});
+
+		$('.fc-event:first').simulate('drag', {
+			dx: 100
+		});
+	});
+
 });