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