1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// @ts-ignore 17import { LitMainMenu } from '../../../dist/base-ui/menu/LitMainMenu.js'; 18import { MenuItem } from '../../../src/base-ui/menu/LitMainMenu.js'; 19 20describe('LitMainMenu Test', () => { 21 it('LitMainMenu01', () => { 22 let litMainMenu = new LitMainMenu(); 23 expect(litMainMenu).not.toBeUndefined(); 24 expect(litMainMenu).not.toBeNull(); 25 }); 26 27 it('LitMainMenu01', () => { 28 let litMainMenu = new LitMainMenu(); 29 expect(litMainMenu).not.toBeUndefined(); 30 expect(litMainMenu).not.toBeNull(); 31 }); 32 33 it('LitMainMenu02', () => { 34 let litMainMenu = new LitMainMenu(); 35 litMainMenu.menus = [ 36 { 37 collapsed: false, 38 title: 'Navigation', 39 describe: 'Open or record a new trace', 40 children: [ 41 { 42 title: 'Open trace file', 43 icon: 'folder', 44 fileChoose: true, 45 fileHandler: function (ev: InputEvent) {}, 46 }, 47 { 48 title: 'Record new trace', 49 icon: 'copyhovered', 50 clickHandler: function (item: MenuItem) {}, 51 }, 52 ], 53 }, 54 ]; 55 expect(litMainMenu.menus.length).toBe(1); 56 }); 57 58 it('LitMainMenu04', () => { 59 let litMainMenu = new LitMainMenu(); 60 litMainMenu.menus = [ 61 { 62 children: [ 63 { 64 title: 'Record new trace Test', 65 icon: 'copyhovered', 66 clickHandler: function (item: MenuItem) {}, 67 }, 68 { 69 title: 'Open trace file Test', 70 icon: 'folder', 71 fileChoose: true, 72 fileHandler: function (ev: InputEvent) {}, 73 }, 74 ], 75 collapsed: true, 76 title: 'Navigation Test', 77 describe: 'Open or record a new trace', 78 }, 79 ]; 80 expect(litMainMenu.menus.length).toBe(1); 81 }); 82}); 83