1fb726d48Sopenharmony_ci/*
2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci * You may obtain a copy of the License at
6fb726d48Sopenharmony_ci *
7fb726d48Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci *
9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci * limitations under the License.
14fb726d48Sopenharmony_ci */
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ciimport { LitTree } from '../../../src/base-ui/tree/LitTree';
17fb726d48Sopenharmony_ci
18fb726d48Sopenharmony_cidescribe('LitTree Test', () => {
19fb726d48Sopenharmony_ci  let litTree = new LitTree();
20fb726d48Sopenharmony_ci  litTree.treeData = [];
21fb726d48Sopenharmony_ci  litTree.multiple = true;
22fb726d48Sopenharmony_ci  litTree.foldable = true;
23fb726d48Sopenharmony_ci
24fb726d48Sopenharmony_ci  it('litTreeTest01', () => {
25fb726d48Sopenharmony_ci    expect(litTree.treeData).toStrictEqual([]);
26fb726d48Sopenharmony_ci  });
27fb726d48Sopenharmony_ci  it('litTreeTest02', () => {
28fb726d48Sopenharmony_ci    expect(litTree.multiple).toStrictEqual(true);
29fb726d48Sopenharmony_ci  });
30fb726d48Sopenharmony_ci  it('litTreeTest03', () => {
31fb726d48Sopenharmony_ci    expect(litTree.foldable).toBeUndefined();
32fb726d48Sopenharmony_ci  });
33fb726d48Sopenharmony_ci  it('litTreeTest04', () => {
34fb726d48Sopenharmony_ci    expect(litTree.getCheckdKeys()).toStrictEqual([]);
35fb726d48Sopenharmony_ci  });
36fb726d48Sopenharmony_ci  it('litTreeTest05', () => {
37fb726d48Sopenharmony_ci    expect(litTree.getCheckdNodes()).toStrictEqual([]);
38fb726d48Sopenharmony_ci  });
39fb726d48Sopenharmony_ci  it('litTreeTest06', () => {
40fb726d48Sopenharmony_ci    expect(litTree.expandKeys(['c', 'a'])).toBeUndefined();
41fb726d48Sopenharmony_ci  });
42fb726d48Sopenharmony_ci  it('litTreeTest07', () => {
43fb726d48Sopenharmony_ci    expect(litTree.collapseKeys(['cq', 'a'])).toBeUndefined();
44fb726d48Sopenharmony_ci  });
45fb726d48Sopenharmony_ci  it('litTreeTest08', () => {
46fb726d48Sopenharmony_ci    expect(litTree.checkedKeys(['a'])).toBeUndefined();
47fb726d48Sopenharmony_ci  });
48fb726d48Sopenharmony_ci  it('litTreeTest09', () => {
49fb726d48Sopenharmony_ci    expect(litTree.uncheckedKeys(['abc'])).toBeUndefined();
50fb726d48Sopenharmony_ci  });
51fb726d48Sopenharmony_ci  it('litTreeTest10', () => {
52fb726d48Sopenharmony_ci    document.body.innerHTML = `<ul id="ul"></ul>`;
53fb726d48Sopenharmony_ci    let ul = document.querySelector('#ul') as HTMLDivElement;
54fb726d48Sopenharmony_ci    expect(litTree.drawTree(ul, [{}, {}], true)).toBeUndefined();
55fb726d48Sopenharmony_ci  });
56fb726d48Sopenharmony_ci  it('litTreeTest11', () => {
57fb726d48Sopenharmony_ci    expect(litTree.selectedNode([{}, {}])).toBeUndefined();
58fb726d48Sopenharmony_ci  });
59fb726d48Sopenharmony_ci  it('litTreeTest12', () => {
60fb726d48Sopenharmony_ci    expect(litTree.closeContextMenu()).toBeUndefined();
61fb726d48Sopenharmony_ci  });
62fb726d48Sopenharmony_ci  it('litTreeTest13', () => {
63fb726d48Sopenharmony_ci    expect(litTree.insert([])).toBeUndefined();
64fb726d48Sopenharmony_ci  });
65fb726d48Sopenharmony_ci  it('litTreeTest14', () => {
66fb726d48Sopenharmony_ci    document.body.innerHTML = `<ul id="ul"></ul>`;
67fb726d48Sopenharmony_ci    let ul = document.querySelector('#ul') as HTMLDivElement;
68fb726d48Sopenharmony_ci    expect(litTree._insertNode(ul, [])).toBeUndefined();
69fb726d48Sopenharmony_ci  });
70fb726d48Sopenharmony_ci  it('litTreeTest15', () => {
71fb726d48Sopenharmony_ci    expect(litTree.connectedCallback()).toBeUndefined();
72fb726d48Sopenharmony_ci    let mouseClickEvent: MouseEvent = new MouseEvent('click', <MouseEventInit>{ clientX: 1, clientY: 2 });
73fb726d48Sopenharmony_ci    litTree.dispatchEvent(mouseClickEvent);
74fb726d48Sopenharmony_ci  });
75fb726d48Sopenharmony_ci  it('litTreeTest16', () => {
76fb726d48Sopenharmony_ci    expect(litTree.onDrag()).toBeUndefined();
77fb726d48Sopenharmony_ci  });
78fb726d48Sopenharmony_ci  it('litTreeTest17', () => {
79fb726d48Sopenharmony_ci    expect(litTree.onDragEnd()).toBeUndefined();
80fb726d48Sopenharmony_ci  });
81fb726d48Sopenharmony_ci  it('litTreeTest18', () => {
82fb726d48Sopenharmony_ci    let ev = {
83fb726d48Sopenharmony_ci      target:{
84fb726d48Sopenharmony_ci        open:true,
85fb726d48Sopenharmony_ci        autoExpand:jest.fn(()=>true),
86fb726d48Sopenharmony_ci      },
87fb726d48Sopenharmony_ci    }
88fb726d48Sopenharmony_ci    expect(litTree.onDragStart(ev)).toBeUndefined();
89fb726d48Sopenharmony_ci  });
90fb726d48Sopenharmony_ci  it('litTreeTest19', () => {
91fb726d48Sopenharmony_ci    let ev = {
92fb726d48Sopenharmony_ci      target:{
93fb726d48Sopenharmony_ci        style:{
94fb726d48Sopenharmony_ci          backgroundColor:'#ffffff',
95fb726d48Sopenharmony_ci        }
96fb726d48Sopenharmony_ci      },
97fb726d48Sopenharmony_ci    }
98fb726d48Sopenharmony_ci    expect(litTree.onDragEnter(ev)).toBeUndefined();
99fb726d48Sopenharmony_ci  });
100fb726d48Sopenharmony_ci  it('litTreeTest20', () => {
101fb726d48Sopenharmony_ci    let ev = {
102fb726d48Sopenharmony_ci      target:{
103fb726d48Sopenharmony_ci        data:{
104fb726d48Sopenharmony_ci          key:1,
105fb726d48Sopenharmony_ci        },
106fb726d48Sopenharmony_ci      },
107fb726d48Sopenharmony_ci      currentTarget:{
108fb726d48Sopenharmony_ci        getBoundingClientRect:jest.fn(()=>true),
109fb726d48Sopenharmony_ci      },
110fb726d48Sopenharmony_ci    }
111fb726d48Sopenharmony_ci    litTree.srcDragElement = jest.fn(()=>true);
112fb726d48Sopenharmony_ci    litTree.srcDragElement.data = jest.fn(()=>true);
113fb726d48Sopenharmony_ci    litTree.srcDragElement.data.key = jest.fn(()=>true);
114fb726d48Sopenharmony_ci    expect(litTree.onDragOver(ev)).toBeUndefined();
115fb726d48Sopenharmony_ci  });
116fb726d48Sopenharmony_ci  it('litTreeTest21', () => {
117fb726d48Sopenharmony_ci    let ev = {
118fb726d48Sopenharmony_ci      target:{
119fb726d48Sopenharmony_ci        style:{
120fb726d48Sopenharmony_ci          backgroundColor:'#ffffff',
121fb726d48Sopenharmony_ci        },
122fb726d48Sopenharmony_ci        drawLine:jest.fn(()=>true),
123fb726d48Sopenharmony_ci      },
124fb726d48Sopenharmony_ci    }
125fb726d48Sopenharmony_ci    expect(litTree.onDragLeave(ev)).toBeUndefined();
126fb726d48Sopenharmony_ci  });
127fb726d48Sopenharmony_ci  it('litTreeTest22', () => {
128fb726d48Sopenharmony_ci    let ev = {
129fb726d48Sopenharmony_ci      target:{
130fb726d48Sopenharmony_ci        style:{
131fb726d48Sopenharmony_ci          backgroundColor:'#ffffff',
132fb726d48Sopenharmony_ci        },
133fb726d48Sopenharmony_ci        data:1,
134fb726d48Sopenharmony_ci        drawLine:jest.fn(()=>true),
135fb726d48Sopenharmony_ci      },
136fb726d48Sopenharmony_ci    };
137fb726d48Sopenharmony_ci    litTree.srcDragElement = jest.fn(()=>true);
138fb726d48Sopenharmony_ci    litTree.srcDragElement.data = jest.fn(()=>true);
139fb726d48Sopenharmony_ci    expect(litTree.onDrop(ev)).toBeUndefined();
140fb726d48Sopenharmony_ci  });
141fb726d48Sopenharmony_ci  it('litTreeTest23', () => {
142fb726d48Sopenharmony_ci    let arr = {
143fb726d48Sopenharmony_ci      findIndex:jest.fn(()=>true),
144fb726d48Sopenharmony_ci      splice:jest.fn(()=>true),
145fb726d48Sopenharmony_ci    };
146fb726d48Sopenharmony_ci    let d = {};
147fb726d48Sopenharmony_ci    expect(litTree.removeDataNode(arr, d)).toBeUndefined();
148fb726d48Sopenharmony_ci  });
149fb726d48Sopenharmony_ci  it('litTreeTest24', () => {
150fb726d48Sopenharmony_ci    let arr = {
151fb726d48Sopenharmony_ci      findIndex:jest.fn(()=>true),
152fb726d48Sopenharmony_ci      splice:jest.fn(()=>true),
153fb726d48Sopenharmony_ci    };
154fb726d48Sopenharmony_ci    let d = {};
155fb726d48Sopenharmony_ci    expect(litTree.addDataNode(arr, d,[],[])).toBeUndefined();
156fb726d48Sopenharmony_ci  });
157fb726d48Sopenharmony_ci});
158