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 { LitAllocationSelect } from '../../../src/base-ui/select/LitAllocationSelect'; 17 18describe('LitAllocationSelect Test', () => { 19 let litAllocationSelect = new LitAllocationSelect(); 20 it('LitAllocationSelectTest01', function () { 21 expect(litAllocationSelect.value).toBe(''); 22 }); 23 it('LitAllocationSelectTest02', () => { 24 expect(litAllocationSelect.processData).toBeUndefined(); 25 }); 26 it('LitAllocationSelectTest03', function () { 27 expect(litAllocationSelect.placement).toBe(''); 28 }); 29 it('LitAllocationSelectTest04', function () { 30 litAllocationSelect.placement = 'bottom'; 31 expect(litAllocationSelect.placement).toBeTruthy(); 32 }); 33 it('LitAllocationSelectTest05', function () { 34 litAllocationSelect.placement = 'bottom'; 35 expect(litAllocationSelect.placement).toBe('bottom'); 36 }); 37 it('LitAllocationSelectTest06', function () { 38 expect(litAllocationSelect.listHeight).toBe('256px'); 39 }); 40 it('LitAllocationSelectTest07', function () { 41 litAllocationSelect.listHeight = 'test'; 42 expect(litAllocationSelect.listHeight).toBe('test'); 43 }); 44 it('LitAllocationSelectTest08', function () { 45 litAllocationSelect.placeholder = 'test'; 46 expect(litAllocationSelect.placeholder).toBe('test'); 47 }); 48 it('LitAllocationSelectTest09', () => { 49 expect(litAllocationSelect.initElements()).toBeUndefined(); 50 }); 51 52 it('LitAllocationSelectTest10', () => { 53 litAllocationSelect.processData = []; 54 expect(litAllocationSelect.processData).toBe(undefined); 55 }); 56 57 it('LitAllocationSelectTest12', () => { 58 litAllocationSelect.processData = ['1', '2', '3']; 59 expect(litAllocationSelect.processData).toBe(undefined); 60 }); 61 62 it('LitAllocationSelectTest11', () => { 63 const onclick = jest.fn(); 64 let allocationSelect = (document.body.innerHTML = ` 65 <lit-allocation-select id='select'></lit-allocation-select> 66 `); 67 const select = document.getElementById('select'); 68 expect(onclick).not.toBeCalled(); 69 select!.onclick = onclick; 70 select!.click(); 71 expect(onclick).toBeCalled(); 72 expect(onclick).toHaveBeenCalledTimes(1); 73 }); 74}); 75