• 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
16window.ResizeObserver = window.ResizeObserver ||
17    jest.fn().mockImplementation(() => ({
18        disconnect: jest.fn(),
19        observe: jest.fn(),
20        unobserve: jest.fn(),
21    }));
22
23// @ts-ignore
24import {SpRecyclerSystemTrace} from "../../../dist/trace/component/SpRecyclerSystemTrace.js"
25
26describe('SpRecyclerSystemTrace Test', ()=>{
27
28    let spRecyclerSystemTrace = new SpRecyclerSystemTrace();
29    const newEl=1;
30    const targetEl = {
31        parentNode:1,
32        nextSibling:1
33    }
34
35    spRecyclerSystemTrace.initElements = jest.fn(()=> true)
36
37
38    it('SpRecyclerSystemTraceTest01', function () {
39        expect(spRecyclerSystemTrace.getScrollWidth()).toBe(1)
40    });
41
42    it('SpRecyclerSystemTraceTest02', function () {
43        let resultLength = spRecyclerSystemTrace.getVisibleRows([{}]).length;
44        expect(resultLength).toBe(0)
45    });
46
47    it('SpRecyclerSystemTraceTest03', function () {
48        expect(spRecyclerSystemTrace.timerShaftELRangeChange('')).toBeUndefined()
49    });
50
51    it('SpRecyclerSystemTraceTest04', function () {
52        expect(spRecyclerSystemTrace.rowsElOnScroll('Scroll')).toBeUndefined()
53    });
54
55    it('SpRecyclerSystemTraceTest05', function () {
56        expect(spRecyclerSystemTrace.documentOnMouseDown('MouseDown')).toBeUndefined()
57    });
58
59    it('SpRecyclerSystemTraceTest06', function () {
60        expect(spRecyclerSystemTrace.documentOnMouseUp('MouseUp')).toBeUndefined()
61    });
62
63    it('SpRecyclerSystemTraceTest07', function () {
64        spRecyclerSystemTrace.rangeSelec = jest.fn(()=>true)
65        spRecyclerSystemTrace.rangeSelect.mouseMove = jest.fn(()=>true)
66        expect(spRecyclerSystemTrace.documentOnMouseMove('MouseMove')).toBeUndefined()
67    });
68
69    it('SpRecyclerSystemTraceTest08', function () {
70        expect(spRecyclerSystemTrace.hoverStructNull('')).toBeUndefined()
71    });
72
73    it('SpRecyclerSystemTraceTest09', function () {
74        expect(spRecyclerSystemTrace.selectStructNull('')).toBeUndefined()
75    });
76
77    it('SpRecyclerSystemTraceTest10', function () {
78        spRecyclerSystemTrace.rangeSelec = jest.fn(()=>true)
79        spRecyclerSystemTrace.rangeSelect.mouseMove = jest.fn(()=>true)
80        expect(spRecyclerSystemTrace.documentOnClick('OnClick')).toBeUndefined()
81    });
82
83    it('SpRecyclerSystemTraceTest11', function () {
84        expect(spRecyclerSystemTrace.connectedCallback()).toBeUndefined()
85    });
86
87    it('SpRecyclerSystemTraceTest12', function () {
88        expect(spRecyclerSystemTrace.disconnectedCallback()).toBeUndefined()
89    });
90
91    it('SpRecyclerSystemTraceTest13', function () {
92        expect(spRecyclerSystemTrace.init).toBeTruthy()
93    });
94
95    it('SpRecyclerSystemTraceTest15', function () {
96        spRecyclerSystemTrace.loadDatabaseUrl = jest.fn(()=>true)
97        expect(spRecyclerSystemTrace.loadDatabaseUrl()).toBeTruthy()
98    });
99
100    it('SpRecyclerSystemTraceTest16', function () {
101        spRecyclerSystemTrace.loadDatabaseArrayBuffer = jest.fn(()=>true)
102        expect(spRecyclerSystemTrace.loadDatabaseArrayBuffer()).toBeTruthy()
103    });
104
105    it('SpRecyclerSystemTraceTest17', function () {
106        expect(spRecyclerSystemTrace.initHtml()).toMatchInlineSnapshot(`
107"
108        <style>
109        :host{
110            display: block;
111            width: 100%;
112            height: 100%;
113        }
114        .timer-shaft{
115            width: 100%;
116            z-index: 2;
117        }
118        .rows{
119            display: flex;
120            box-sizing: border-box;
121            flex-direction: column;
122            overflow-y: auto;
123            max-height: calc(100vh - 150px - 48px);
124            flex: 1;
125            width: 100%;
126        }
127        .container{
128            width: 100%;
129            box-sizing: border-box;
130            height: 100%;
131            display: grid;
132            grid-template-columns: 1fr;
133            grid-template-rows: min-content 1fr min-content;
134        }
135
136        </style>
137        <div class=\\"container\\">
138            <timer-shaft-element class=\\"timer-shaft\\">
139            </timer-shaft-element>
140            <trace-row-recycler-view class=\\"rows\\">
141            </trace-row-recycler-view>
142            <trace-sheet class=\\"trace-sheet\\" mode=\\"hidden\\">
143            </trace-sheet>
144        </div>
145        "
146`)
147    });
148    it('SpRecyclerSystemTraceTest18', function () {
149        const newEl=1;
150        const targetEl = {
151            parentNode:{
152                insertBefore:jest.fn(()=>true)
153            },
154            nextSibling:1
155        }
156
157        expect(spRecyclerSystemTrace.insertAfter(newEl, targetEl)).toBeUndefined()
158    });
159})
160