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 {TraceRowRecyclerView} from "../../../../../dist/trace/component/trace/base/TraceRowRecyclerView.js"; 18 19describe("TraceRow Test", () => { 20 beforeAll(() => { 21 }) 22 23 it('Utils Test01', () => { 24 let traceRow = new TraceRowRecyclerView(); 25 expect(traceRow) 26 }); 27 28 it('Test02', function () { 29 let traceRow = new TraceRowRecyclerView(); 30 expect(traceRow.dataSource).toBeTruthy(); 31 }); 32 33 it('Test03', function () { 34 let traceRow = new TraceRowRecyclerView(); 35 traceRow.measureHeight = jest.fn(()=>true) 36 traceRow.dataSource = true 37 expect(traceRow.dataSource).toBeTruthy(); 38 }); 39 40 it('Test04', function () { 41 let traceRow = new TraceRowRecyclerView(); 42 expect(traceRow.renderType).toBeTruthy(); 43 }); 44 45 it('Test05', function () { 46 let traceRow = new TraceRowRecyclerView(); 47 traceRow.renderType=false 48 expect(traceRow.renderType).toBeFalsy(); 49 }); 50 51 it('Test06', function () { 52 let traceRow = new TraceRowRecyclerView(); 53 const obj={ 54 folder:false, 55 top:0, 56 name:"", 57 children:false, 58 rowId:"", 59 rowType:"", 60 rowParentId:"1", 61 expansion:false, 62 rowHidden:false, 63 rowHeight:40 64 } 65 const el={ 66 obj:undefined, 67 style:{top:1,visibility:'visible'}, 68 name:"", 69 rowId:"", 70 rowType:"", 71 rowParentId:"1", 72 expansion:false, 73 rowHidden:false, 74 setAttribute:"", 75 removeAttribute:"" 76 77 } 78 expect(traceRow.refreshRow(el,!obj)).toBeUndefined(); 79 }); 80 81 it('Test08', function () { 82 let traceRow = new TraceRowRecyclerView(); 83 expect(traceRow.initUI()).toBeUndefined(); 84 }); 85 86 it('Test09', function () { 87 let traceRow = new TraceRowRecyclerView(); 88 expect(traceRow.initUI()).toBeUndefined(); 89 }); 90 91 it('Test09', function () { 92 let traceRow = new TraceRowRecyclerView(); 93 expect(traceRow.initHtml()).toMatchInlineSnapshot(` 94" 95 <style> 96 :host{ 97 width:100%; 98 height:100%; 99 display: block; 100 position:relative; 101 } 102 .container{ 103 width:100%; 104 height:100%; 105 overflow: auto; 106 position: absolute; 107 display: block; 108 } 109 .gasket{ 110 width:100%; 111 height:auto; 112 top: 0; 113 left: 0; 114 right:0; 115 bottom:0; 116 visibility: hidden; 117 } 118 .recycler-cell{ 119 position: absolute; 120 width:100%; 121 visibility: hidden; 122 top: 0; 123 left: 0; 124 } 125 </style> 126 <div class=\\"container\\"> 127 <div class=\\"gasket\\"></div> 128 </div> 129 130 " 131`) 132 }); 133})