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 LitSwitch from '../../../dist/base-ui/switch/lit-switch'; 18 19describe('LitSwitch Test', () => { 20 let litSwitch = new LitSwitch(); 21 litSwitch.checked = true; 22 litSwitch.checked = false; 23 litSwitch.disabled = true; 24 litSwitch.disabled = false; 25 26 it('LitSwitchTest01', () => { 27 expect(litSwitch.name).toBeNull(); 28 }); 29 30 it('LitSwitchTest02', () => { 31 expect(litSwitch.disabled).toBeFalsy(); 32 }); 33 34 it('LitSwitchTest03', () => { 35 expect(litSwitch.checked).toBeFalsy(); 36 }); 37 38 it('LitSwitchTest04', () => { 39 LitSwitch.switch = document.querySelector('#switch') as HTMLInputElement; 40 expect(litSwitch.connectedCallback()).toBeUndefined(); 41 }); 42 43 it('LitSwitchTest05', () => { 44 expect(litSwitch.attributeChangedCallback('disabled', 'disabled', '')).toBeUndefined(); 45 }); 46 47 it('LitSwitchTest06', () => { 48 expect(litSwitch.attributeChangedCallback('disabled', 'disabled', null)).toBeUndefined(); 49 }); 50 51 it('LitSwitchTest07', () => { 52 expect(litSwitch.attributeChangedCallback('checked', 'disabled', '')).toBeUndefined(); 53 }); 54 55 it('LitSwitchTest08', () => { 56 expect(litSwitch.attributeChangedCallback('checked', 'disabled', null)).toBeUndefined(); 57 }); 58}); 59