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 16import { TabPaneFilter } from '../../../../../src/trace/component/trace/sheet/TabPaneFilter'; 17jest.mock('../../../../../src/js-heap/model/DatabaseStruct', () => { 18 return {}; 19}); 20describe('TabPaneFilter Test', () => { 21 let tabPaneFilter = new TabPaneFilter(); 22 23 it('TabPaneFilterTest01', function () { 24 expect(tabPaneFilter.firstSelect).toBe(''); 25 }); 26 27 it('TabPaneFilterTest02', function () { 28 expect(tabPaneFilter.secondSelect).toBe(''); 29 }); 30 31 it('TabPaneFilterTest03', function () { 32 expect(tabPaneFilter.filterValue).toBe(''); 33 }); 34 35 it('TabPaneFilterTest04', function () { 36 tabPaneFilter.filterValue = true; 37 expect(tabPaneFilter.filterValue).toBeTruthy(); 38 }); 39 40 it('TabPaneFilterTest05', function () { 41 expect(tabPaneFilter.icon).toBe('block'); 42 }); 43 44 it('TabPaneFilterTest08', function () { 45 tabPaneFilter.iconEL.name = 'menu'; 46 expect(tabPaneFilter.icon).toBe('block'); 47 }); 48 49 it('TabPaneFilterTest09', function () { 50 tabPaneFilter.iconEL.name = ''; 51 expect(tabPaneFilter.icon).toBe(''); 52 }); 53 54 it('TabPaneFilterTest06', function () { 55 tabPaneFilter.icon = true; 56 expect(tabPaneFilter.icon).toBe(''); 57 }); 58 59 it('TabPaneFilterTest010', function () { 60 tabPaneFilter.icon = 'block'; 61 expect(tabPaneFilter.icon).toBe('block'); 62 }); 63 64 it('TabPaneFilterTest011', function () { 65 tabPaneFilter.icon = 'tree'; 66 expect(tabPaneFilter.icon).toBe('tree'); 67 }); 68 69 it('TabPaneFilterTest10', function () { 70 expect(tabPaneFilter.addDataMining({ name: '' }, '')).toBe(-1); 71 }); 72 73 it('TabPaneFilterTest11', function () { 74 expect(tabPaneFilter.getFilterTreeData()).not.toBeUndefined(); 75 }); 76 77 it('TabPaneFilterTest12', function () { 78 expect(tabPaneFilter.initializeFilterTree(true, true, true)).toBeUndefined(); 79 }); 80 81 it('TabPaneFilterTest13', function () { 82 expect(tabPaneFilter.disabledMining).toBeFalsy(); 83 }); 84 85 it('TabPaneFilterTest14', function () { 86 tabPaneFilter.disabledMining = true; 87 expect(tabPaneFilter.disabledMining).toBeTruthy(); 88 }); 89 it('TabPaneFilterTest15', function () { 90 let mouseClickEvent: MouseEvent = new MouseEvent('click', <MouseEventInit>{ clientX: 1, clientY: 2 }); 91 tabPaneFilter.iconEL.name = 'statistics'; 92 tabPaneFilter.iconEL.dispatchEvent(mouseClickEvent); 93 }); 94 it('TabPaneFilterTest16', function () { 95 let mouseClickEvent: MouseEvent = new MouseEvent('click', <MouseEventInit>{ clientX: 1, clientY: 2 }); 96 tabPaneFilter.iconEL.name = 'menu'; 97 tabPaneFilter.iconEL.dispatchEvent(mouseClickEvent); 98 }); 99 it('TabPaneFilterTest17', function () { 100 let mouseClickEvent: MouseEvent = new MouseEvent('click', <MouseEventInit>{ clientX: 1, clientY: 2 }); 101 tabPaneFilter.getFilter = jest.fn(()=>true); 102 tabPaneFilter.markButtonEL.dispatchEvent(mouseClickEvent); 103 }); 104 it('TabPaneFilterTest18', function () { 105 let mouseChangeEvent: MouseEvent = new MouseEvent('change', <MouseEventInit>{ clientX: 1, clientY: 2 }); 106 tabPaneFilter.firstSelectEL.dispatchEvent(mouseChangeEvent); 107 }); 108 it('TabPaneFilterTest19', function () { 109 let mouseChangeEvent: MouseEvent = new MouseEvent('change', <MouseEventInit>{ clientX: 1, clientY: 2 }); 110 tabPaneFilter.secondSelectEL.dispatchEvent(mouseChangeEvent); 111 }); 112 it('TabPaneFilterTest20', function () { 113 let mouseChangeEvent: MouseEvent = new MouseEvent('change', <MouseEventInit>{ clientX: 1, clientY: 2 }); 114 tabPaneFilter.thirdSelectEL.dispatchEvent(mouseChangeEvent); 115 }); 116}); 117