Summary Table
| Categories |
Total Count |
| PII |
0 |
| URL |
0 |
| DNS |
0 |
| EKL |
0 |
| IP |
0 |
| PORT |
0 |
| VsID |
0 |
| CF |
0 |
| AI |
0 |
| VPD |
0 |
| PL |
0 |
| Other |
0 |
File Content
define(['moment', 'SuccessController'], function (moment) {
'use strict';
describe('Success Controller', function () {
var controller,
scope,
stateMock,
focusServiceMock;
beforeEach(function () {
module('angularTemplateApp');
stateMock = jasmine.createSpyObj('$state', ['go']);
focusServiceMock = jasmine.createSpyObj('focusService', ['focusElement'])
module(function ($provide) {
$provide.value('$state', stateMock);
$provide.value('$stateParams', {
topText: 'Top Text',
submitType: 'appointment'
});
$provide.value('focusService', focusServiceMock);
$provide.value('globalDelayTracker', {});
});
inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
controller = $controller;
});
});
describe("initial state", function () {
beforeEach(function () {
controller = controller('SuccessController', {$scope: scope});
});
it("should correctly set the statusTemplate", function () {
expect(scope.statusTemplate).toEqual('modules/applets/shared/pages/submit-status/success/success_template.html');
});
it("should correctly set the submittedDate", function () {
expect(scope.submittedDate).toEqual(moment().format('dddd, MMMM D, YYYY'));
});
it("should extend the stateParams", function () {
expect(scope.topText).toEqual('Top Text');
expect(scope.submitType).toEqual('appointment');
});
});
describe("goHome function", function () {
it("should redirect the user to the app-select page", function () {
controller = controller('SuccessController', {$scope: scope});
scope.goHome();
expect(stateMock.go).toHaveBeenCalledWith('main.app-select');
});
});
it("should extend the SubheaderController", function () {
controller = controller('SuccessController', {$scope: scope});
expect(focusServiceMock.focusElement).toHaveBeenCalledWith('.primary-header h2');
});
});
});