Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 2d2406e

Browse files
committed
fix(calendar.js): do not alter original execution context #107 #87 #105
Signed-off-by: joshkurz <josh.kurz@turner.com>
1 parent d6550d1 commit 2d2406e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/calendar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ angular.module('ui.calendar', [])
2626
// In this way the function will be safely executed on the next digest.
2727

2828
var args = arguments;
29+
var _this = this;
2930
$timeout(function(){
30-
functionToWrap.apply(this, args);
31+
functionToWrap.apply(_this, args);
3132
});
3233
};
3334
}

test/calendar.spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,7 @@ describe('uiCalendar', function () {
375375
var fullCalendarConfig = calendarCtrl.getFullCalendarConfig(scope.uiConfig.calendar, {});
376376

377377
fullCalendarConfig[key]();
378-
379378
$timeout.flush();
380-
381379
expect($rootScope.$apply.callCount).toBe(functionCount);
382380
expect(scope.uiConfig.calendar[key]).toHaveBeenCalled();
383381
$rootScope.$apply.isSpy = false;
@@ -414,7 +412,6 @@ describe('uiCalendar', function () {
414412

415413
scope.$apply();
416414
$timeout.flush();
417-
418415
expect($rootScope.$apply.callCount).toBe(functionCount*2);
419416
expect(scope.uiConfig.calendar[key]).toHaveBeenCalled();
420417
}

0 commit comments

Comments
 (0)