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 { SpTraceCommand } from '../../../../src/trace/component/setting/SpTraceCommand'; 17 18describe('SPTraceCommand Test', () => { 19 beforeAll(() => { 20 document.body.innerHTML = ` 21 <trace-command id = "command"><trace-command> 22 `; 23 }); 24 it('new SPTraceCommand', function () { 25 expect(new SpTraceCommand()).not.toBeNull(); 26 }); 27 28 it(' SpAllocations get Default attrValue', function () { 29 let spEle = document.querySelector('#command') as SpTraceCommand; 30 expect(spEle.hdcCommon).toEqual(''); 31 }); 32 33 it(' SpAllocations set attrValue', function () { 34 let spEle = document.querySelector('#command') as SpTraceCommand; 35 spEle.hdcCommon = 'test'; 36 expect(spEle.hdcCommon).toEqual('test'); 37 }); 38 39 it(' SpTraceCommandtest01', function () { 40 let spEle = document.querySelector('#command') as SpTraceCommand; 41 spEle.show = false; 42 expect(spEle.show).toBeFalsy(); 43 }); 44 it(' SpTraceCommandtest02', function () { 45 let spEle = document.querySelector('#command') as SpTraceCommand; 46 spEle.show = true; 47 expect(spEle.show).toBeTruthy(); 48 }); 49 it(' SpTraceCommandtest03', function () { 50 let spEle = document.querySelector('#command') as SpTraceCommand; 51 expect(spEle.disconnectedCallback()).toBeUndefined(); 52 }); 53}); 54