diff --git a/tests/automated/event-dnd.js b/tests/automated/event-dnd.js index f1f3110..78778cc 100644 --- a/tests/automated/event-dnd.js +++ b/tests/automated/event-dnd.js @@ -32,11 +32,7 @@ describe('eventDrop', function() { .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { dx: $('.fc-day').width() * 2, - dy: $('.fc-day').height(), - interpolation: { - stepCount: 10, - duration: 100 - } + dy: $('.fc-day').height() }); }, function(event, delta, revertFunc) { @@ -72,11 +68,7 @@ describe('eventDrop', function() { .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { dx: $('.fc-day').width() * -2, - dy: $('.fc-day').height(), - interpolation: { - stepCount: 10, - duration: 100 - } + dy: $('.fc-day').height() }); }, function(event, delta, revertFunc) { @@ -118,13 +110,8 @@ describe('eventDrop', function() { .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { dx: $('th.fc-wed').width(), // 1 day - dy: $('tr.fc-slot1').height() * 3, // 1.5 hours - interpolation: { - stepCount: 10, - duration: 100 - } + dy: $('tr.fc-slot1').height() * 3 // 1.5 hours }); - called = true; }, function(event, delta, revertFunc) { expect(delta.days()).toBe(1); @@ -158,13 +145,8 @@ describe('eventDrop', function() { $('.fc-event') .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { - dx: $('th.fc-wed').width() * 2, // 2 days - interpolation: { - stepCount: 10, - duration: 100 - } + dx: $('th.fc-wed').width() * 2 // 2 days }); - called = true; }, function(event, delta, revertFunc) { expect(delta.days()).toBe(2); @@ -200,13 +182,8 @@ describe('eventDrop', function() { .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { dx: $('th.fc-wed').width() * -1, - dy: $('.fc-agenda-allday').outerHeight() + $('.fc-agenda-divider').outerHeight(), - interpolation: { - stepCount: 10, - duration: 100 - } + dy: $('.fc-agenda-allday').outerHeight() + $('.fc-agenda-divider').outerHeight() }); - called = true; }, function(event, delta, revertFunc) { expect(delta.days()).toBe(-1); @@ -247,10 +224,6 @@ describe('eventDrop', function() { .simulate('drag', { dx: $('th.fc-wed').width() * -1, dy: -$('.fc-agenda-allday').outerHeight(), - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { // the all day slot works off of mouse-moving coordinates var offset = eventElm.offset(); diff --git a/tests/automated/event-resize.js b/tests/automated/event-resize.js index 57e2b66..6ccae95 100644 --- a/tests/automated/event-resize.js +++ b/tests/automated/event-resize.js @@ -32,11 +32,7 @@ describe('eventResize', function() { .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { dx: $('.fc-day').width() * -2, - dy: $('.fc-day').height(), - interpolation: { - stepCount: 10, - duration: 100 - } + dy: $('.fc-day').height() }); }, function(event, delta, revertFunc) { @@ -92,11 +88,7 @@ describe('eventResize', function() { $('.fc-event .ui-resizable-handle') .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { - dx: $('th.fc-wed').width() * 1.5, // two days - interpolation: { - stepCount: 10, - duration: 100 - } + dx: $('th.fc-wed').width() * 1.5 // two days }); }, function(event, delta, revertFunc) { @@ -118,25 +110,23 @@ describe('eventResize', function() { }); }); - describe('when resizing a timed event', function() { - it('should have correct arguments with a timed delta', function(done) { + describe('when resizing a timed event with an end', function() { + beforeEach(function() { options.events = [ { title: 'timed event event', start: '2014-06-11T05:00:00', end: '2014-06-11T07:00:00', allDay: false } ]; + }); + it('should have correct arguments with a timed delta', function(done) { init( function() { $('.fc-event .ui-resizable-handle') .simulate('mouseover') // for our dumb optimization .simulate('drag-n-drop', { - dy: $('tr.fc-slot1').height() * 4.5, // 5 slots, so 2.5 hours - interpolation: { - stepCount: 10, - duration: 100 - } + dy: $('tr.fc-slot1').height() * 4.5 // 5 slots, so 2.5 hours }); }, function(event, delta, revertFunc) { diff --git a/tests/automated/select-callback.js b/tests/automated/select-callback.js index 68c7cdb..00818d7 100644 --- a/tests/automated/select-callback.js +++ b/tests/automated/select-callback.js @@ -38,10 +38,6 @@ describe('select callback', function() { $('#cal').fullCalendar(options); $('.fc-day[data-date="2014-04-28"]').simulate('drag-n-drop', { dropTarget: '.fc-day[data-date="2014-05-06"]', - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -63,10 +59,6 @@ describe('select callback', function() { $('#cal').fullCalendar(options); $('.fc-day[data-date="2014-04-28"]').simulate('drag-n-drop', { dropTarget: '.fc-day[data-date="2014-04-28"]', - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -95,10 +87,6 @@ describe('select callback', function() { $('#cal').fullCalendar(options); $('.fc-agenda-allday .fc-day-content').simulate('drag-n-drop', { // middle will be 2014-05-28 dx: $('.fc-sun').outerWidth() * (isRTL ? -1 : 1), // the width of one column - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -119,10 +107,6 @@ describe('select callback', function() { spyOn(options, 'select').and.callThrough(); $('#cal').fullCalendar(options); $('.fc-agenda-allday .fc-day-content').simulate('drag-n-drop', { // middle will be 2014-05-28 - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -146,10 +130,6 @@ describe('select callback', function() { $('#cal').fullCalendar(options); $('tr.fc-slot18 td').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 dy: $('tr.fc-slot18 td').outerHeight() * 2, // move down two slots - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -170,10 +150,6 @@ describe('select callback', function() { spyOn(options, 'select').and.callThrough(); $('#cal').fullCalendar(options); $('tr.fc-slot18 td').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 - interpolation: { - stepCount: 10, - duration: 100 - }, callback: function() { expect(options.select).toHaveBeenCalled(); done(); diff --git a/tests/lib/jquery-simulate-hacks.js b/tests/lib/jquery-simulate-hacks.js index c006874..fa529f3 100644 --- a/tests/lib/jquery-simulate-hacks.js +++ b/tests/lib/jquery-simulate-hacks.js @@ -28,4 +28,27 @@ }; } + + /* + Give jquery-simulate-ext drag-n-drop a default interpolation. + */ + + var originalSimulate = $.fn.simulate; + + $.fn.simulate = function(eventName, options) { + + if (eventName == 'drag' || eventName == 'drop' || eventName == 'drag-n-drop') { + options = options || {}; + if (options.interpolation === undefined) { + options.interpolation = { + stepCount: 10, + duration: 100 + }; + } + return originalSimulate.call(this, eventName, options); + } + + return originalSimulate.apply(this, arguments); + }; + })(jQuery); \ No newline at end of file