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 { TraceRowRecyclerView } from '../../../../../src/trace/component/trace/base/TraceRowRecyclerView'; 17 18jest.mock('../../../../../src/trace/database/ui-worker/ProcedureWorker', () => { 19 return {}; 20}); 21 22 23describe('TraceRow Test', () => { 24 beforeAll(() => {}); 25 26 it('Utils Test01', () => { 27 let traceRow = new TraceRowRecyclerView(); 28 expect(traceRow); 29 }); 30 31 it('Test02', function () { 32 let traceRow = new TraceRowRecyclerView(); 33 expect(traceRow.dataSource).toBeTruthy(); 34 }); 35 36 it('Test03', function () { 37 let traceRow = new TraceRowRecyclerView(); 38 traceRow.measureHeight = jest.fn(() => true); 39 traceRow.dataSource = true; 40 expect(traceRow.dataSource).toBeTruthy(); 41 }); 42 43 it('Test04', function () { 44 let traceRow = new TraceRowRecyclerView(); 45 expect(traceRow.renderType).toBeTruthy(); 46 }); 47 48 it('Test05', function () { 49 let traceRow = new TraceRowRecyclerView(); 50 traceRow.renderType = false; 51 expect(traceRow.renderType).toBeFalsy(); 52 }); 53 54 it('Test06', function () { 55 let traceRow = new TraceRowRecyclerView(); 56 const obj = { 57 folder: false, 58 top: 0, 59 name: '', 60 children: false, 61 rowId: '', 62 rowType: '', 63 rowParentId: '1', 64 expansion: false, 65 rowHidden: false, 66 rowHeight: 40, 67 }; 68 const el = { 69 obj: undefined, 70 style: { top: 1, visibility: 'visible' }, 71 name: '', 72 rowId: '', 73 rowType: '', 74 rowParentId: '1', 75 expansion: false, 76 rowHidden: false, 77 setAttribute: '', 78 removeAttribute: '', 79 }; 80 expect(traceRow.refreshRow(el, !obj)).toBeUndefined(); 81 }); 82 83 it('Test08', function () { 84 let traceRow = new TraceRowRecyclerView(); 85 expect(traceRow.initUI()).toBeUndefined(); 86 }); 87 88 it('Test09', function () { 89 let traceRow = new TraceRowRecyclerView(); 90 expect(traceRow.initUI()).toBeUndefined(); 91 }); 92 it('Test10', function () { 93 let traceRow = new TraceRowRecyclerView(); 94 let mouseScrollEvent: MouseEvent = new MouseEvent('scroll', <MouseEventInit>{ clientX: 1, clientY: 2 }); 95 traceRow.vessel.dispatchEvent(mouseScrollEvent); 96 }); 97 98}); 99