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 {LitSelectOption} from "../../../dist/base-ui/select/LitSelectOption.js"; 18 19describe('LitSelectOption Test', ()=> { 20 it('LitSelectOptionTest01', function () { 21 document.body.innerHTML = "<lit-select-option id ='aa' disabled></lit-select-option>"; 22 let inner = document.querySelector("#aa") as LitSelectOption; 23 expect(inner).not.toBeUndefined() 24 }); 25 it('LitSelectOptionTest03', function () { 26 expect(LitSelectOption.adoptedCallback).toBeUndefined() 27 28 }); 29 30 it('LitSelectOptionTest04', function () { 31 expect(LitSelectOption.disconnectedCallback).toBeUndefined() 32 33 }); 34 35 it('LitSelectOptionTest05', function () { 36 expect(LitSelectOption.attributeChangedCallback).toBeUndefined() 37 38 }); 39 40 it('LitSelectOption02', function () { 41 let litSelect = new LitSelectOption(); 42 expect(litSelect.initHtml()).toMatchInlineSnapshot(` 43" 44 <style> 45 :host{ 46 display: flex; 47 padding: 8px 10px; 48 transition: all .3s; 49 color: var(--dark-color2,#333); 50 tab-index: -1; 51 /*overflow: scroll;*/ 52 align-items: center; 53 /*justify-content: space-between;*/ 54 font-size: 0.8rem; 55 } 56 :host(:not([disabled])[selected]){ 57 background-color: #0A59F7; 58 color: #ffffff; 59 font-weight: bold; 60 } 61 :host(:not([disabled]):not([selected]):hover){ 62 background-color: var(--dark-background7,#f5f5f5); 63 } 64 :host([disabled]){ 65 cursor: not-allowed; 66 color: var(--dark-color,#bfbfbf); 67 } 68 :host([selected][check]) .check{ 69 display: flex; 70 } 71 :host(:not([selected])) .check{ 72 display: none; 73 } 74 :host(:not([check])) .check{ 75 display: none; 76 } 77 78 :host([disabled]) .selected-box{ 79 display: none; 80 } 81 :host([selected]) .selected{ 82 display: flex; 83 color: #FFFFFF; 84 } 85 :host(:not([selected])) .selected{ 86 display: none; 87 } 88 </style> 89 <div style=\\"height: 16px;width: 16px\\" class=\\"selected-box\\"> 90 <lit-icon class=\\"selected\\" name=\\"check\\"></lit-icon> 91 </div> 92 <slot></slot> 93<!-- <lit-icon class=\\"check\\" name=\\"check\\"></lit-icon>--> 94 " 95`); 96 }); 97});