فهرست منبع

test for not firing dayClick if touch moves away

Adam Shaw 9 سال پیش
والد
کامیت
77cb3e6f4f
1فایلهای تغییر یافته به همراه21 افزوده شده و 0 حذف شده
  1. 21 0
      tests/automated/dayClick.js

+ 21 - 0
tests/automated/dayClick.js

@@ -165,6 +165,27 @@ describe('dayClick', function() {
 			});
 		});
 
+		it('won\'t fire if touch moves outside of date cell', function(done) {
+			options.dayClick = function(date, jsEvent, view) {};
+			spyOn(options, 'dayClick').and.callThrough();
+
+			$('#cal').fullCalendar(options);
+
+			var startCell = $('.fc-day[data-date="2014-05-07"]');
+			var endCell = $('.fc-day[data-date="2014-05-08"]');
+
+			startCell.simulate('drag', {
+				// FYI, when debug:true, not a good representation because the minimal  delay is required
+				// to recreate bug #3332
+				isTouch: true,
+				end: endCell,
+				callback: function() {
+					expect(options.dayClick).not.toHaveBeenCalled();
+					done();
+				}
+			});
+		});
+
 		it('fires correctly when simulated click on a cell', function(done) {
 			options.dayClick = function(date, jsEvent, view) {
 				expect(moment.isMoment(date)).toEqual(true);