• 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 {TabPaneSlices} from "../../../../../../dist/trace/component/trace/sheet/process/TabPaneSlices.js"
18
19const sqlit = require("../../../../../../dist/trace/database/SqlLite.js")
20jest.mock("../../../../../../dist/trace/database/SqlLite.js");
21
22window.ResizeObserver = window.ResizeObserver ||
23    jest.fn().mockImplementation(() => ({
24        disconnect: jest.fn(),
25        observe: jest.fn(),
26        unobserve: jest.fn(),
27    }));
28
29describe('TabPaneSlices Test', () => {
30    let tabPaneSlices = new TabPaneSlices();
31
32    it('TabPaneSlicesTest01', function () {
33        expect(tabPaneSlices.sortByColumn({
34            key: 'name',
35            sort: () => {
36            }
37        })).toBeUndefined();
38    });
39
40    it('TabPaneSlicesTest05', function () {
41        expect(tabPaneSlices.sortByColumn({
42            key: !'name',
43            sort: () => {
44            }
45        })).toBeUndefined();
46    });
47
48    it('TabPaneSlicesTest04', function () {
49        expect(tabPaneSlices.initHtml()).toMatchInlineSnapshot(`
50"
51        <style>
52        :host{
53            display: flex;
54            flex-direction: column;
55            padding: 10px 10px;
56        }
57        </style>
58        <label id=\\"time-range\\" style=\\"width: 100%;height: 20px;text-align: end;font-size: 10pt;margin-bottom: 5px\\">Selected range:0.0 ms</label>
59        <lit-table id=\\"tb-slices\\" style=\\"height: auto\\">
60            <lit-table-column title=\\"Name\\" width=\\"500px\\" data-index=\\"name\\" key=\\"name\\"  align=\\"flex-start\\" order>
61            </lit-table-column>
62            <lit-table-column title=\\"Wall duration(ms)\\" width=\\"1fr\\" data-index=\\"wallDuration\\" key=\\"wallDuration\\"  align=\\"flex-start\\" order >
63            </lit-table-column>
64            <lit-table-column title=\\"Avg Wall duration(ms)\\" width=\\"1fr\\" data-index=\\"avgDuration\\" key=\\"avgDuration\\"  align=\\"flex-start\\" order >
65            </lit-table-column>
66            <lit-table-column title=\\"Occurrences\\" width=\\"1fr\\" data-index=\\"occurrences\\" key=\\"occurrences\\"  align=\\"flex-start\\" order >
67            </lit-table-column>
68        </lit-table>
69        "
70`);
71    });
72})
73