blob: 84a61de7642f95518d3babb421b219bfc8c1c44c [file] [log] [blame]
Max Chu886c89f2017-08-24 15:44:27 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
19import * as angular from 'angular';
20import 'angular-mocks';
21import {IXosConfirm, XosConfirm} from './confirm.service';
22
23let service: IXosConfirm;
24let modal;
25let modalInstance;
26
27describe('The XosConfirm service', () => {
28
29 beforeEach(() => {
30 angular.module('XosConfirmTest', ['ui.bootstrap.modal'])
31 .service('XosConfirm', XosConfirm);
32 angular.mock.module('XosConfirmTest');
33
34 angular.mock.inject((
35 XosConfirm: IXosConfirm,
36 $uibModal: any
37 ) => {
38 service = XosConfirm;
39 modal = $uibModal;
40 });
41 });
42
43 describe('the open method', () => {
44
45 let test1 = {
46 header: 'Test Header',
47 text: 'Test body',
48 actions: [{
49 label: 'Action',
50 cb: () => {
51 return;
52 },
53 class: 'btn-success'
54 }]
55 };
56
57 it('should open a modal', () => {
58 spyOn(modal, 'open');
59 modalInstance = service.open(test1);
60 expect(modal.open).toHaveBeenCalled();
61 });
62 });
63
64 // describe('the close method', () => {
65 //
66 // });
67 //
68 // describe('the dismiss method', () => {
69 //
70 // });
71
72});