/*** Created by npatil2 */ describe('RationaleController', function () { var modalInstance, $httpBackend, isRationalRequired; beforeEach(module('myitsmApp')); beforeEach(inject(function ($rootScope, $controller) { this.scope = $rootScope.$new(); this.controller = $controller; isRationalRequired = { close: jasmine.createSpy('modalInstance.close'), dismiss: jasmine.createSpy('modalInstance.dismiss'), result: { then: jasmine.createSpy('modalInstance.result.then') } }; modalInstance = { close: jasmine.createSpy('modalInstance.close'), dismiss: jasmine.createSpy('modalInstance.dismiss'), result: { then: jasmine.createSpy('modalInstance.result.then') } }; this.controllerInstance = this.controller('RationaleController', { $scope: this.scope, $modalInstance: modalInstance, isRationalRequired: isRationalRequired }); })); it('should defined', function () { expect(this.controllerInstance).toBeDefined(); }); it('should run done ,cancel and broadcast $stateChangeStart event ', function () { this.scope.done(); this.scope.cancel(); this.scope.$emit('$stateChangeStart'); expect(this.scope.textAreaIsFocused).toBe(false); expect(this.scope.rationale).toEqual(''); }); });