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 16// @ts-ignore 17import {SpProbesConfig} from "../../../../dist/trace/component/setting/SpProbesConfig.js"; 18import {LitCheckBox} from "../../../../src/base-ui/checkbox/LitCheckBox"; 19 20describe('SpProbesConfig Test', ()=>{ 21 beforeAll(() => { 22 document.body.innerHTML = ` 23 <probes-config id = "spconfig"><probes-config> 24 ` 25 }) 26 it('new SpProbesConfig', function () { 27 expect(new SpProbesConfig()).not.toBeNull(); 28 }); 29 30 it(' SpProbesConfig get Default attrValue', function () { 31 let spEle = document.querySelector("#spconfig") as SpProbesConfig 32 expect(spEle.traceConfig).toEqual([]) 33 expect(spEle.traceEvents).toEqual([]) 34 expect(spEle.memoryConfig).toEqual([]) 35 }); 36 37 it(' SpProbesConfig test', function () { 38 let spEle = document.querySelector("#spconfig") as SpProbesConfig 39 expect(spEle.initHtml()).toMatchInlineSnapshot(` 40" 41 <style> 42 :host{ 43 display: inline-block; 44 width: 100%; 45 height: 100%; 46 background: var(--dark-background3,#FFFFFF); 47 border-radius: 0px 16px 16px 0px; 48 } 49 50 .root { 51 padding-top: 30px; 52 padding-left: 54px; 53 margin-right: 30px; 54 font-size:16px; 55 margin-bottom: 30px; 56 } 57 .recordText { 58 font-family: Helvetica-Bold; 59 font-size: 1em; 60 color: var(--dark-color1,#000000); 61 line-height: 28px; 62 font-weight: 700; 63 margin-bottom: 20px; 64 } 65 66 .config-page { 67 height: 95%; 68 font-size: 0.875em; 69 } 70 71 .trace-config{ 72 display: grid; 73 grid-template-columns: repeat(2, 1fr); 74 gap: 10px; 75 margin-bottom: 20px; 76 } 77 78 .memory-config{ 79 display: grid; 80 grid-template-columns: repeat(2, 1fr); 81 border-style: solid none none none; 82 border-color: #D5D5D5; 83 padding-top: 15px; 84 margin-top: 15px; 85 gap: 10px; 86 } 87 88 .span-col-2{ 89 grid-column: span 2 / auto; 90 } 91 92 .log-config{ 93 display: grid; 94 grid-template-columns: repeat(2, 1fr); 95 border-style: solid none none none; 96 border-color: #D5D5D5; 97 padding-top: 15px; 98 gap: 10px; 99 } 100 101 #hitrace-cat{ 102 display: grid; 103 grid-template-columns: 1fr 1fr; 104 } 105 .user-events{ 106 display: grid; 107 grid-template-columns: repeat(4, 1fr); 108 grid-template-rows: repeat(2, 1fr); 109 gap: 10px; 110 margin-left: 15px;; 111 } 112 </style> 113 <div class=\\"root\\"> 114 <div class=\\"recordText\\" >Record mode</div> 115 <div class=\\"config-page\\"> 116 <div> 117 <div class=\\"trace-config\\"></div> 118 <div class=\\"span-col-2\\" id=\\"hitrace-cat\\"> 119 <check-des-box id=\\"hitrace\\" value =\\"Hitrace categories\\" des=\\"Enables C++ codebase annotations (HTRACE_BEGIN() / os.Trace())\\"> 120 </check-des-box> 121 <div class=\\"user-events\\"> 122 <slot></slot> 123 </div> 124 </div> 125 </div> 126 <div class=\\"memory-config\\"> 127 <div class=\\"span-col-2\\"> 128 <span>Memory Config</span> 129 </div> 130 </div> 131 </div> 132 </div> 133 " 134`); 135 }); 136})