Explorar o código

tests: month view event resizing for touch

Adam Shaw %!s(int64=9) %!d(string=hai) anos
pai
achega
34d945eb46
Modificáronse 1 ficheiros con 46 adicións e 1 borrados
  1. 46 1
      tests/automated/event-resize.js

+ 46 - 1
tests/automated/event-resize.js

@@ -18,7 +18,7 @@ describe('eventResize', function() {
 			options.defaultView = 'month';
 		});
 
-		describe('when resizing an all-day event', function() {
+		describe('when resizing an all-day event with mouse', function() {
 			it('should have correct arguments with a whole-day delta', function(done) {
 				options.events = [ {
 					title: 'all-day event',
@@ -52,6 +52,51 @@ describe('eventResize', function() {
 			});
 		});
 
+		describe('when resizing an all-day event via touch', function() {
+
+			it('should have correct arguments with a whole-day delta', function(done) {
+				options.isTouch = true;
+				options.longPressDelay = 100;
+				options.dragRevertDuration = 0; // so that eventDragStop happens immediately after touchend
+				options.events = [ {
+					title: 'all-day event',
+					start: '2014-06-11',
+					allDay: true
+				} ];
+
+				init(
+					function() {
+						$('.fc-event').simulate('drag', {
+							isTouch: true,
+							delay: 200,
+							onRelease: function() {
+								$('.fc-event .fc-resizer').simulate('drag', {
+									dx: $('.fc-day').width() * -2.5, // guarantee 2 days to left
+									dy: $('.fc-day').height(),
+									isTouch: true
+								});
+							}
+						});
+					},
+					function(event, delta, revertFunc) {
+						expect(delta.asDays()).toBe(5);
+						expect(delta.hours()).toBe(0);
+						expect(delta.minutes()).toBe(0);
+						expect(delta.seconds()).toBe(0);
+						expect(delta.milliseconds()).toBe(0);
+
+						expect(event.start).toEqualMoment('2014-06-11');
+						expect(event.end).toEqualMoment('2014-06-17');
+						revertFunc();
+						expect(event.start).toEqualMoment('2014-06-11');
+						expect(event.end).toBeNull();
+
+						done();
+					}
+				);
+			});
+		});
+
 		describe('when rendering a timed event', function() {
 			it('should not have resize capabilities', function(done) {
 				options.events = [ {