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 {LitIcon} from "../../../dist/base-ui/icon/LitIcon.js"; 18 19describe("testLitIcon Test", () => { 20 21 it('testLitIcon01', () => { 22 let litIcon = new LitIcon(); 23 expect(litIcon).not.toBeUndefined() 24 expect(litIcon).not.toBeNull() 25 }); 26 27 it('testLitIcon02', () => { 28 let litIcon = new LitIcon(); 29 expect(litIcon.path).toBeUndefined() 30 }); 31 32 it('testLitIcon03', () => { 33 let litIcon = new LitIcon(); 34 litIcon.path ="ss" 35 expect(litIcon.path).toBeUndefined() 36 }); 37 38 it('testLitIcon04', () => { 39 let litIcon = new LitIcon(); 40 expect(litIcon.size).toBe(0) 41 }); 42 43 it('testLitIcon05', () => { 44 let litIcon = new LitIcon(); 45 litIcon.size = 1024 46 expect(litIcon.size).toBe(1024) 47 }); 48 49 it('testLitIcon06', () => { 50 let litIcon = new LitIcon(); 51 expect(litIcon.name).toBe("") 52 }); 53 54 it('testLitIcon07', () => { 55 let litIcon = new LitIcon(); 56 litIcon.name = "sss" 57 expect(litIcon.name).toBe("sss") 58 }); 59 60 it('testLitIcon07', () => { 61 let litIcon = new LitIcon(); 62 expect(litIcon.color = "#FFF").not.toBeUndefined(); 63 }); 64 65 it('testLitIcon07', () => { 66 let litIcon = new LitIcon(); 67 expect(litIcon.initHtml()).toMatchInlineSnapshot(` 68" 69 <style> 70 :host{ 71 font-size: inherit; 72 display: inline-block; 73 /*transition: .3s;*/ 74 } 75 :host([spin]){ 76 animation: rotate 1.75s linear infinite; 77 } 78 @keyframes rotate { 79 to{ 80 transform: rotate(360deg); 81 } 82 } 83 .icon{ 84 display: block; 85 width: 1em; 86 height: 1em; 87 margin: auto; 88 fill: currentColor; 89 overflow: hidden; 90 } 91 </style> 92 <svg class=\\"icon\\" id=\\"icon\\" aria-hidden=\\"true\\" viewBox=\\"0 0 1024 1024\\"> 93 <use id=\\"use\\"></use> 94 </svg> 95 " 96`); 97 }); 98}) 99