describe('Testing calendarView', function() { 'use strict'; var $scope, $compile, element, ctrl, $httpBackend; beforeEach(function() { module('myitsmApp', 'templates'); inject(function($rootScope, _$compile_, $injector) { $scope = $rootScope.$new(); $compile = _$compile_; $httpBackend = $injector.get('$httpBackend'); var getLocale = function(){ return readJSON('scripts/app/i18n/resources-locale_en.json'); }; $httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale()); $httpBackend.whenGET('/smartit/rest/v2/metadata?type=global').respond(200); $httpBackend.whenGET('/smartit/rest/v2/metadata?type=change').respond(200); }); }); it('ensures callFoo does whatever it is supposed to', function() { var calendarCtrl = { model: { expanded: false, calendarViews: ['book', 'day', 'week', 'month'], showWeekends: true, calendarTypes: [ {id: 'changes', selected: true}, {id: 'outages', selected: true}, {id: 'businessEvents', selected: true} ], context: $scope.context, editMode: $scope.editMode, isNew: $scope.isNew, currentRequestResourceId: "CurrentCRQ", thisCrqSortWeight: 1, collisionCrqSortWeight: 10, collisionOutageSortWeight: 60, collisionBusinessEventSortWeight: 80, addressedCollisions: {}, zoomInDisabled: false, zoomOutDisabled: false } }; element = $compile(angular.element(''))($scope); element.data('$calendarController', calendarCtrl); $compile(element)($scope); var elementScope = element.find('calendar-view').scope(); //need to rewrite calendar-view directive to test it, not possible with the current implementation as it requires the parent calendar directive }); });