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 { LitCheckBox } from '../../../src/base-ui/checkbox/LitCheckBox'; 17 18describe('checkBox Test', () => { 19 it('checkBoxTest01', function () { 20 let litCheckBox = new LitCheckBox(); 21 expect(litCheckBox).not.toBeUndefined(); 22 expect(litCheckBox).not.toBeNull(); 23 }); 24 25 it('checkBoxTest02', function () { 26 let litCheckBox = new LitCheckBox(); 27 expect(litCheckBox.checked).toBeFalsy(); 28 }); 29 30 it('checkBoxTest03', function () { 31 let litCheckBox = new LitCheckBox(); 32 litCheckBox.checked = true; 33 expect(litCheckBox.checked).toBeTruthy(); 34 }); 35 36 it('checkBoxTest04', function () { 37 let litCheckBox = new LitCheckBox(); 38 expect(litCheckBox.value).toEqual(''); 39 }); 40 41 it('checkBoxTest04', function () { 42 let litCheckBox = new LitCheckBox(); 43 litCheckBox.value = 'test'; 44 expect(litCheckBox.value).toEqual('test'); 45 }); 46 47 it('checkBoxTest05', function () { 48 document.body.innerHTML = `<lit-check-box></lit-check-box> 49 `; 50 let litCheckBox = new LitCheckBox(); 51 litCheckBox.checked = false; 52 expect(litCheckBox.checked).toBeFalsy(); 53 }); 54 it('checkBoxTest06', function () { 55 document.body.innerHTML = `<lit-check-box></lit-check-box> 56 `; 57 let litCheckBox = new LitCheckBox(); 58 litCheckBox.indeterminate = false; 59 expect(litCheckBox.indeterminate).toBeFalsy(); 60 }); 61 62 it('checkBoxTest07', function () { 63 document.body.innerHTML = `<lit-check-box></lit-check-box> 64 `; 65 let litCheckBox = new LitCheckBox(); 66 litCheckBox.indeterminate = true; 67 expect(litCheckBox.indeterminate).toBeTruthy(); 68 }); 69}); 70