1fb726d48Sopenharmony_ci/* 2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License. 5fb726d48Sopenharmony_ci * You may obtain a copy of the License at 6fb726d48Sopenharmony_ci * 7fb726d48Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8fb726d48Sopenharmony_ci * 9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and 13fb726d48Sopenharmony_ci * limitations under the License. 14fb726d48Sopenharmony_ci */ 15fb726d48Sopenharmony_ci 16fb726d48Sopenharmony_ciimport { LitAllocationSelect } from '../../../src/base-ui/select/LitAllocationSelect'; 17fb726d48Sopenharmony_ci 18fb726d48Sopenharmony_cidescribe('LitAllocationSelect Test', () => { 19fb726d48Sopenharmony_ci let litAllocationSelect = new LitAllocationSelect(); 20fb726d48Sopenharmony_ci it('LitAllocationSelectTest01', function () { 21fb726d48Sopenharmony_ci expect(litAllocationSelect.value).toBe(''); 22fb726d48Sopenharmony_ci }); 23fb726d48Sopenharmony_ci it('LitAllocationSelectTest02', () => { 24fb726d48Sopenharmony_ci expect(litAllocationSelect.processData).toBeUndefined(); 25fb726d48Sopenharmony_ci }); 26fb726d48Sopenharmony_ci it('LitAllocationSelectTest03', function () { 27fb726d48Sopenharmony_ci expect(litAllocationSelect.placement).toBe(''); 28fb726d48Sopenharmony_ci }); 29fb726d48Sopenharmony_ci it('LitAllocationSelectTest04', function () { 30fb726d48Sopenharmony_ci litAllocationSelect.placement = 'bottom'; 31fb726d48Sopenharmony_ci expect(litAllocationSelect.placement).toBeTruthy(); 32fb726d48Sopenharmony_ci }); 33fb726d48Sopenharmony_ci it('LitAllocationSelectTest05', function () { 34fb726d48Sopenharmony_ci litAllocationSelect.placement = 'bottom'; 35fb726d48Sopenharmony_ci expect(litAllocationSelect.placement).toBe('bottom'); 36fb726d48Sopenharmony_ci }); 37fb726d48Sopenharmony_ci it('LitAllocationSelectTest06', function () { 38fb726d48Sopenharmony_ci expect(litAllocationSelect.listHeight).toBe('256px'); 39fb726d48Sopenharmony_ci }); 40fb726d48Sopenharmony_ci it('LitAllocationSelectTest07', function () { 41fb726d48Sopenharmony_ci litAllocationSelect.listHeight = 'test'; 42fb726d48Sopenharmony_ci expect(litAllocationSelect.listHeight).toBe('test'); 43fb726d48Sopenharmony_ci }); 44fb726d48Sopenharmony_ci it('LitAllocationSelectTest08', function () { 45fb726d48Sopenharmony_ci litAllocationSelect.placeholder = 'test'; 46fb726d48Sopenharmony_ci expect(litAllocationSelect.placeholder).toBe('test'); 47fb726d48Sopenharmony_ci }); 48fb726d48Sopenharmony_ci it('LitAllocationSelectTest09', () => { 49fb726d48Sopenharmony_ci expect(litAllocationSelect.initElements()).toBeUndefined(); 50fb726d48Sopenharmony_ci }); 51fb726d48Sopenharmony_ci 52fb726d48Sopenharmony_ci it('LitAllocationSelectTest10', () => { 53fb726d48Sopenharmony_ci litAllocationSelect.processData = []; 54fb726d48Sopenharmony_ci expect(litAllocationSelect.processData).toBe(undefined); 55fb726d48Sopenharmony_ci }); 56fb726d48Sopenharmony_ci 57fb726d48Sopenharmony_ci it('LitAllocationSelectTest12', () => { 58fb726d48Sopenharmony_ci litAllocationSelect.processData = ['1', '2', '3']; 59fb726d48Sopenharmony_ci expect(litAllocationSelect.processData).toBe(undefined); 60fb726d48Sopenharmony_ci }); 61fb726d48Sopenharmony_ci 62fb726d48Sopenharmony_ci it('LitAllocationSelectTest11', () => { 63fb726d48Sopenharmony_ci const onclick = jest.fn(); 64fb726d48Sopenharmony_ci let allocationSelect = (document.body.innerHTML = ` 65fb726d48Sopenharmony_ci <lit-allocation-select id='select'></lit-allocation-select> 66fb726d48Sopenharmony_ci `); 67fb726d48Sopenharmony_ci const select = document.getElementById('select'); 68fb726d48Sopenharmony_ci expect(onclick).not.toBeCalled(); 69fb726d48Sopenharmony_ci select!.onclick = onclick; 70fb726d48Sopenharmony_ci select!.click(); 71fb726d48Sopenharmony_ci expect(onclick).toBeCalled(); 72fb726d48Sopenharmony_ci expect(onclick).toHaveBeenCalledTimes(1); 73fb726d48Sopenharmony_ci }); 74fb726d48Sopenharmony_ci}); 75