Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | ONOS GUI -- Topo View -- Topo Toolbar Service - Unit Tests |
| 19 | */ |
| 20 | describe('factory: view/topo/topoToolbar.js', function() { |
Bri Prebilic Cole | 2efc715 | 2015-04-29 15:47:06 -0700 | [diff] [blame] | 21 | var $log, fs, ttbs, prefs, ps, |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 22 | d3Elem; |
| 23 | |
| 24 | beforeEach(module('ovTopo', 'onosUtil', 'onosLayer', 'ngRoute', 'onosNav', |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 25 | 'onosWidget', 'onosMast')); |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 26 | |
| 27 | beforeEach(inject(function (_$log_, FnService, |
| 28 | TopoToolbarService, PanelService, PrefsService) { |
| 29 | $log = _$log_; |
| 30 | fs = FnService; |
Bri Prebilic Cole | 2efc715 | 2015-04-29 15:47:06 -0700 | [diff] [blame] | 31 | ttbs = TopoToolbarService; |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 32 | prefs = PrefsService; |
| 33 | ps = PanelService; |
| 34 | d3Elem = d3.select('body').append('div').attr('id', 'floatpanels'); |
| 35 | ps.init(); |
| 36 | })); |
| 37 | |
Matteo Scandolo | 209c6c6 | 2016-05-21 10:08:57 -0700 | [diff] [blame] | 38 | it('should define TopoToolbarService', function () { |
Bri Prebilic Cole | 2efc715 | 2015-04-29 15:47:06 -0700 | [diff] [blame] | 39 | expect(ttbs).toBeDefined(); |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 40 | }); |
| 41 | |
Matteo Scandolo | 812aa5a | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 42 | xit('should define api functions', function () { |
Matteo Scandolo | 209c6c6 | 2016-05-21 10:08:57 -0700 | [diff] [blame] | 43 | // FIXME |
| 44 | // areFunctions check that each key of the object is a fn, what if it is a string or whatever? |
Bri Prebilic Cole | 2efc715 | 2015-04-29 15:47:06 -0700 | [diff] [blame] | 45 | expect(fs.areFunctions(ttbs, [ |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 46 | 'init', 'createToolbar', 'destroyToolbar', |
Matteo Scandolo | 209c6c6 | 2016-05-21 10:08:57 -0700 | [diff] [blame] | 47 | 'keyListener', 'toggleToolbar', 'setDefaultOverlay', |
| 48 | 'fnkey' |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 49 | ])).toBeTruthy(); |
| 50 | }); |
| 51 | |
Bri Prebilic Cole | 2efc715 | 2015-04-29 15:47:06 -0700 | [diff] [blame] | 52 | // NOTE: topoToolbar relies too much on topo's closure variables |
| 53 | // to adequately test it |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame] | 54 | |
| 55 | }); |