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