blob: 68ac9236a724688cf844a172dc014be522695bc1 [file] [log] [blame]
Simon Hunt639dc662015-02-18 14:19:20 -08001/*
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 */
20describe('factory: fw/layer/quickhelp.js', function () {
Bri Prebilic Coleef091902015-04-28 16:53:47 -070021 var $log, fs, qhs, d3Elem;
Simon Hunt639dc662015-02-18 14:19:20 -080022
23 beforeEach(module('onosUtil', 'onosSvg', 'onosLayer'));
24
Bri Prebilic Coleef091902015-04-28 16:53:47 -070025 beforeEach(inject(function (_$log_, FnService, QuickHelpService) {
Simon Hunt639dc662015-02-18 14:19:20 -080026 $log = _$log_;
Simon Hunt639dc662015-02-18 14:19:20 -080027 fs = FnService;
28 qhs = QuickHelpService;
Bri Prebilic Coleef091902015-04-28 16:53:47 -070029 jasmine.clock().install();
Simon Hunt639dc662015-02-18 14:19:20 -080030 d3Elem = d3.select('body').append('div').attr('id', 'myqhdiv');
31 }));
32
33 afterEach(function () {
Bri Prebilic Coleef091902015-04-28 16:53:47 -070034 jasmine.clock().uninstall();
Simon Hunt639dc662015-02-18 14:19:20 -080035 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