Skip to content

Commit

Permalink
fix(calendar.js): do not alter original execution context angular-ui#107
Browse files Browse the repository at this point in the history
  • Loading branch information
jkurz committed Jul 2, 2014
1 parent d6550d1 commit 2d2406e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ angular.module('ui.calendar', [])
// In this way the function will be safely executed on the next digest.

var args = arguments;
var _this = this;
$timeout(function(){
functionToWrap.apply(this, args);
functionToWrap.apply(_this, args);
});
};
}
Expand Down
3 changes: 0 additions & 3 deletions test/calendar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,7 @@ describe('uiCalendar', function () {
var fullCalendarConfig = calendarCtrl.getFullCalendarConfig(scope.uiConfig.calendar, {});

fullCalendarConfig[key]();

$timeout.flush();

expect($rootScope.$apply.callCount).toBe(functionCount);
expect(scope.uiConfig.calendar[key]).toHaveBeenCalled();
$rootScope.$apply.isSpy = false;
Expand Down Expand Up @@ -414,7 +412,6 @@ describe('uiCalendar', function () {

scope.$apply();
$timeout.flush();

expect($rootScope.$apply.callCount).toBe(functionCount*2);
expect(scope.uiConfig.calendar[key]).toHaveBeenCalled();
}
Expand Down

0 comments on commit 2d2406e

Please sign in to comment.