• 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
16jest.mock('../../../../../src/trace/component/trace/base/TraceRow', () => {
17  return {};
18});
19
20jest.mock('../../../../../src/trace/database/ui-worker/ProcedureWorker', () => {
21    return {};
22});
23jest.mock('../../../../../src/trace/database/ui-worker/ProcedureWorkerSnapshot', () => {
24  return {};
25});
26jest.mock('../../../../../src/js-heap/model/DatabaseStruct', () => {
27    return {};
28});
29
30import { TabPaneFlag } from '../../../../../src/trace/component/trace/timer-shaft/TabPaneFlag';
31class ResizeObserver {
32    callback: any;
33    constructor(callback) {
34      this.callback = callback;
35    }
36    observe() {}
37    unobserve() {}
38    disconnect() {}
39  }
40
41global.ResizeObserver = ResizeObserver;
42describe('TabPaneFlag Test', () => {
43  const canvas = document.createElement('canvas');
44  canvas.width = 1;
45  canvas.height = 1;
46  const ctx = canvas.getContext('2d');
47  let tabPaneFlag = new TabPaneFlag();
48
49  it('TabPaneFlagTest01', function () {
50    document.body.innerHTML = '<tabpane-flag id="remove-flag"> </tabpane-flag>';
51    tabPaneFlag = document.querySelector('#remove-flag') as TabPaneFlag;
52    let htmlButtonElement = document.createElement('button') as HTMLButtonElement;
53    document.body.appendChild(htmlButtonElement);
54    htmlButtonElement.dispatchEvent(new Event('click'));
55    expect(tabPaneFlag.initElements()).toBeUndefined();
56  });
57
58  it('TabPaneFlagTest02', function () {
59    expect(tabPaneFlag.initHtml()).not.toBe('');
60  });
61});
62