Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix(dayView): dont throw when dragging an event and the date range se…

…lect is enabled

Closes #439
  • Loading branch information...
Matt Lewis
Matt Lewis committed Sep 3, 2016
1 parent 06bc836 commit 1e3efdd386d728f11f6d04c9f9fb3ceb582dcb6b
Showing with 12 additions and 4 deletions.
  1. +6 −4 src/directives/mwlCalendarHourList.js
  2. +6 −0 test/unit/directives/mwlCalendarHourList.spec.js
@@ -103,11 +103,13 @@ angular
};

vm.onDragSelectEnd = function(date) {
vm.dateRangeSelect.endDate = date;
if (vm.dateRangeSelect.endDate > vm.dateRangeSelect.startDate) {
vm.onDateRangeSelect({calendarRangeStartDate: vm.dateRangeSelect.startDate, calendarRangeEndDate: vm.dateRangeSelect.endDate});
if (vm.dateRangeSelect) {
vm.dateRangeSelect.endDate = date;
if (vm.dateRangeSelect.endDate > vm.dateRangeSelect.startDate) {
vm.onDateRangeSelect({calendarRangeStartDate: vm.dateRangeSelect.startDate, calendarRangeEndDate: vm.dateRangeSelect.endDate});
}
delete vm.dateRangeSelect;
}
delete vm.dateRangeSelect;
};

})
@@ -177,4 +177,10 @@ describe('mwlCalendarHourList directive', function() {
expect(element[0].querySelector('.cal-day-hour-part-spacer.foo')).to.be.ok;
});

it('should not throw if there is no current range being selected', function() {
expect(function() {
MwlCalendarCtrl.onDragSelectEnd(new Date());
}).not.to.throw();
});

});

0 comments on commit 1e3efdd

Please sign in to comment.
You can’t perform that action at this time.