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 {LitPopover} from "../../../dist/base-ui/popover/LitPopover.js"; 18 19describe("LitPopover Test", () => { 20 it('LitPopover01', () => { 21 let litPopover = new LitPopover(); 22 expect(litPopover).not.toBeUndefined() 23 expect(litPopover).not.toBeNull() 24 }); 25 26 it('LitPopover02', () => { 27 let litPopover = new LitPopover(); 28 expect(litPopover.open).toBeFalsy() 29 }); 30 31 it('LitPopover03', () => { 32 let litPopover = new LitPopover(); 33 litPopover.open = true 34 expect(litPopover.open).toBeTruthy() 35 }); 36 37 it('LitPopover04', () => { 38 let litPopover = new LitPopover(); 39 litPopover.open = false 40 expect(litPopover.open).toBeFalsy() 41 }); 42 43 44 it('LitPopover05', () => { 45 let litPopover = new LitPopover(); 46 litPopover.direction = "topleft" 47 expect(litPopover.direction).toEqual("topleft") 48 }); 49 50 it('LitPopover06', () => { 51 let litPopover = new LitPopover(); 52 expect(litPopover.direction).toEqual("topright") 53 }); 54 55 it('LitPopover07', () => { 56 let litPopover = new LitPopover(); 57 litPopover.type = "multiple" 58 litPopover.dataSource = [{ 59 text: "# Samples", 60 isSelected: true 61 }] 62 expect(litPopover.select).toEqual(["# Samples"]) 63 }); 64 65 it('LitPopover07', () => { 66 let litPopover = new LitPopover(); 67 litPopover.type = "radio" 68 litPopover.dataSource = [{ 69 text: "# Samples", 70 isSelected: true 71 }] 72 expect(litPopover.select).toEqual(["# Samples"]) 73 }); 74 75 it('LitPopover08', () => { 76 let litPopover = new LitPopover(); 77 litPopover.type = "multiple-text" 78 litPopover.dataSource = [{ 79 text: "# Samples", 80 isSelected: true 81 }] 82 expect(litPopover.select).toEqual(["# Samples"]) 83 }); 84 85 86 it('LitPopover09', () => { 87 let litPopover = new LitPopover(); 88 litPopover.type = "radio" 89 litPopover.title = "tee" 90 litPopover.dataSource = [{ 91 text: "# Samples", 92 isSelected: true 93 }] 94 expect(litPopover.select).toEqual(["# Samples"]) 95 }); 96}) 97