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 { LitTree } from '../../../dist/base-ui/tree/LitTree.js'; 18 19describe('LitTree Test', () => { 20 let litTree = new LitTree(); 21 litTree.treeData = []; 22 litTree.multiple = true; 23 litTree.foldable = true; 24 25 it('litTreeTest01', () => { 26 expect(litTree.treeData).toStrictEqual([]); 27 }); 28 it('litTreeTest02', () => { 29 expect(litTree.multiple).toStrictEqual(true); 30 }); 31 it('litTreeTest03', () => { 32 expect(litTree.foldable).toBeUndefined(); 33 }); 34 it('litTreeTest04', () => { 35 expect(litTree.getCheckdKeys()).toStrictEqual([]); 36 }); 37 it('litTreeTest05', () => { 38 expect(litTree.getCheckdNodes()).toStrictEqual([]); 39 }); 40 it('litTreeTest06', () => { 41 expect(litTree.expandKeys(['c','a'])).toBeUndefined(); 42 }); 43 it('litTreeTest07', () => { 44 expect(litTree.collapseKeys(['cq','a'])).toBeUndefined(); 45 }); 46 it('litTreeTest08', () => { 47 expect(litTree.checkedKeys(['a'])).toBeUndefined(); 48 }); 49 it('litTreeTest09', () => { 50 expect(litTree.uncheckedKeys(['abc'])).toBeUndefined(); 51 }); 52 it('litTreeTest10', () => { 53 document.body.innerHTML = `<ul id="ul"></ul>`; 54 let ul = document.querySelector('#ul') as HTMLDivElement; 55 expect(litTree.drawTree(ul,[{},{}],true)).toBeUndefined(); 56 }); 57 it('litTreeTest11', () => { 58 expect(litTree.selectedNode([{},{}])).toBeUndefined(); 59 }); 60 it('litTreeTest12', () => { 61 expect(litTree.closeContextMenu()).toBeUndefined(); 62 }); 63 it('litTreeTest13', () => { 64 expect(litTree.insert([])).toBeUndefined(); 65 }); 66 it('litTreeTest14', () => { 67 document.body.innerHTML = `<ul id="ul"></ul>`; 68 let ul = document.querySelector('#ul') as HTMLDivElement; 69 expect(litTree._insertNode(ul,[])).toBeUndefined(); 70 }); 71}); 72