Procházet zdrojové kódy

fix navLinks going to wrong day. fixes #3869

Adam Shaw před 8 roky
rodič
revize
a5fc5da400
2 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. 1 0
      src/Calendar.render.js
  2. 11 0
      tests/legacy/navLinks.js

+ 1 - 0
src/Calendar.render.js

@@ -219,6 +219,7 @@ Calendar.mixin({
 		this.unbindViewHandlers(currentView);
 
 		currentView.removeElement();
+		currentView.unsetDate(); // so bindViewHandlers doesn't fire with old values next time
 
 		this.view = null;
 	},

+ 11 - 0
tests/legacy/navLinks.js

@@ -28,6 +28,17 @@ describe('navLinks', function() {
 			expect(options.dayClick).not.toHaveBeenCalled();
 		});
 
+		// https://github.com/fullcalendar/fullcalendar/issues/3869
+		it('moves to two different days', function() {
+			$('#cal').fullCalendar(options);
+			$.simulateMouseClick(getDayGridNumberEl('2016-08-09'));
+			expectDayView('agendaDay', '2016-08-09');
+			expect(options.dayClick).not.toHaveBeenCalled();
+			$('#cal').fullCalendar('changeView', 'month');
+			$.simulateMouseClick(getDayGridNumberEl('2016-08-10'));
+			expectDayView('agendaDay', '2016-08-10');
+		});
+
 		it('moves to agendaDay specifically', function() {
 			options.navLinkDayClick = 'agendaDay';
 			$('#cal').fullCalendar(options);