Simon Hunt | 639dc66 | 2015-02-18 14:19:20 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 -- Layer -- Flash Service - Unit Tests |
| 19 | */ |
| 20 | describe('factory: fw/layer/quickhelp.js', function () { |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame^] | 21 | var $log, fs, qhs, d3Elem; |
Simon Hunt | 639dc66 | 2015-02-18 14:19:20 -0800 | [diff] [blame] | 22 | |
| 23 | beforeEach(module('onosUtil', 'onosSvg', 'onosLayer')); |
| 24 | |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame^] | 25 | beforeEach(inject(function (_$log_, FnService, QuickHelpService) { |
Simon Hunt | 639dc66 | 2015-02-18 14:19:20 -0800 | [diff] [blame] | 26 | $log = _$log_; |
Simon Hunt | 639dc66 | 2015-02-18 14:19:20 -0800 | [diff] [blame] | 27 | fs = FnService; |
| 28 | qhs = QuickHelpService; |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame^] | 29 | jasmine.clock().install(); |
Simon Hunt | 639dc66 | 2015-02-18 14:19:20 -0800 | [diff] [blame] | 30 | d3Elem = d3.select('body').append('div').attr('id', 'myqhdiv'); |
| 31 | })); |
| 32 | |
| 33 | afterEach(function () { |
Bri Prebilic Cole | ef09190 | 2015-04-28 16:53:47 -0700 | [diff] [blame^] | 34 | jasmine.clock().uninstall(); |
Simon Hunt | 639dc66 | 2015-02-18 14:19:20 -0800 | [diff] [blame] | 35 | d3.select('#myqhdiv').remove(); |
| 36 | }); |
| 37 | |
| 38 | function helpItemSelection() { |
| 39 | return d3Elem.selectAll('.help'); |
| 40 | } |
| 41 | |
| 42 | it('should define QuickHelpService', function () { |
| 43 | expect(qhs).toBeDefined(); |
| 44 | }); |
| 45 | |
| 46 | it('should define api functions', function () { |
| 47 | expect(fs.areFunctions(qhs, [ |
| 48 | 'initQuickHelp', 'showQuickHelp', 'hideQuickHelp' |
| 49 | ])).toBeTruthy(); |
| 50 | }); |
| 51 | |
| 52 | it('should have no items to start', function () { |
| 53 | expect(helpItemSelection().size()).toBe(0); |
| 54 | }); |
| 55 | |
| 56 | // TODO: check that the help stuff appears |
| 57 | /* |
| 58 | it('should show help items', function () { |
| 59 | var item, rect, text; |
| 60 | flash.flash('foo'); |
| 61 | //jasmine.clock().tick(101); |
| 62 | setTimeout(function () { |
| 63 | item = flashItemSelection(); |
| 64 | expect(item.size()).toEqual(1); |
| 65 | expect(item.classed('flashItem')).toBeTruthy(); |
| 66 | expect(item.select('rect').size()).toEqual(1); |
| 67 | text = item.select('text'); |
| 68 | expect(text.size()).toEqual(1); |
| 69 | expect(text.text()).toEqual('foo'); |
| 70 | }, 100); |
| 71 | }); |
| 72 | */ |
| 73 | }); |
| 74 | |