• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {SpInfoAndStats} from "../../../dist/trace/component/SpInfoAndStas.js"
18
19describe('SpInfoAndStasTest', ()=> {
20    document.body.innerHTML = `<sp-info-and-stats id="ddd"></sp-info-and-stats>`
21    let spInfoAndStats = document.querySelector('#ddd') as SpInfoAndStats
22    it('SpInfoAndStasTest01', function () {
23        let spInfoAndStats =new SpInfoAndStats();
24        expect(spInfoAndStats.initElements()).toBeUndefined()
25    });
26
27    it('SpInfoAndStasTest03', function () {
28        spInfoAndStats.initMetricItemData = jest.fn(()=>true)
29        expect(spInfoAndStats.initMetricItemData()).toBeTruthy()
30    });
31
32    it('SpInfoAndStasTest04', function () {
33        let spInfoAndStats =new SpInfoAndStats();
34        expect(spInfoAndStats.initDataTableStyle({children:
35                [{length:1,style:{backgroundColor:'var(--dark-background5,#F6F6F6)'}}]
36        })).toBeUndefined()
37    });
38
39    it('SpInfoAndStasTest06 ', function () {
40        expect(spInfoAndStats.connectedCallback()).toBeUndefined()
41
42    });
43
44    it('SpInfoAndStasTest07 ', function () {
45        expect(spInfoAndStats.disconnectedCallback()).toBeUndefined()
46
47    });
48
49    it('SpInfoAndStasTest08 ', function () {
50        expect(spInfoAndStats.attributeChangedCallback([],[],[])).toBeUndefined()
51
52    });
53
54    it('SpInfoAndStasTest05', function () {
55        expect(spInfoAndStats.initHtml()).toMatchInlineSnapshot(`
56"
57        <style>
58            :host{
59                width: 100%;
60                background-color: var(--dark-background5,#F6F6F6);
61                margin: 0;
62                padding: 0;
63            }
64
65            .info-stats{
66                display: flex;
67                flex-direction: column;
68                background-color: var(--dark-background5,#F6F6F6);
69                position: absolute;
70                top: 0;
71                bottom: 0;
72                left: 0;
73                right: 0;
74                grid-row-gap: 30px;
75            }
76
77            .metadata{
78                width: 90%;
79                color: #121212;
80                padding: 1% 2% 0 2%;
81                margin: 1% 2.5% 0 2.5%;
82                border-radius: 16px;
83                background-color: var(--dark-background3,#FFFFFF);
84                position: relative;
85            }
86
87            #metaData-table{
88                background-color: var(--dark-background5,#F6F6F6);
89                margin-left: 10px;
90                min-height: inherit;
91                max-height: inherit;
92                padding: 10px;
93            }
94
95            #stats-table{
96                margin-bottom: 2%;
97                margin-left: 10px;
98                padding: 10px;
99            }
100
101            #dataValueResult{
102                overflow-y: auto;
103                background-color: var(--dark-background5,#F6F6F6);
104                border-radius: 16px;
105                min-height: inherit;
106                max-height: inherit;
107                margin-bottom: 1%;
108            }
109
110            #dataKeyResult{
111                overflow-y: auto;
112                background-color: var(--dark-background5,#F6F6F6);
113                border-radius: 16px;
114                min-height: inherit;
115                max-height: inherit;
116                margin-bottom: 2%;
117            }
118
119            p{
120                 display: table-cell;
121                 padding: 7px 10px 20px 10px;
122                 color: #999999;
123                 font-size:14px;
124                 line-height: 20px;
125                 font-weight: 400;
126                 text-align: left;
127            }
128
129            .stats{
130               flex-grow: 1;
131               height: min-content;
132               margin-bottom: 1%;
133               max-height: 37vh;
134               min-height: inherit;
135               display: flex;
136               flex-direction: column;
137            }
138
139            .info{
140               max-height: inherit;
141               min-height: inherit;
142            }
143
144            .tr{
145               background-color: var(--dark-background5,#F6F6F6);
146            }
147
148            .load-metric{
149                width: 95%;
150                bottom: 0;
151            }
152
153        </style>
154
155        <div class=\\"info-stats\\">
156            <div class=\\"metadata info\\">
157                <p>System info and metadata</p>
158                <div id=\\"dataKeyResult\\">
159                    <lit-table id=\\"metaData-table\\">
160                            <lit-table-column title=\\"name\\" data-index=\\"name\\" key=\\"name\\" align=\\"flex-start\\">
161                            </lit-table-column>
162                            <lit-table-column title=\\"value\\" data-index=\\"value\\" key=\\"value\\" align=\\"flex-start\\">
163                            </lit-table-column>
164                    </lit-table>
165                </div>
166                <lit-progress-bar class=\\"load-metric\\"></lit-progress-bar>
167            </div>
168            <div class=\\"metadata stats\\">
169                <p>Debugging stats</p>
170                <div id=\\"dataValueResult\\">
171                    <lit-table id=\\"stats-table\\">
172                            <lit-table-column title=\\"name\\" data-index=\\"event_name\\" key=\\"name\\" align=\\"flex-start\\">
173                            </lit-table-column>
174                            <lit-table-column title=\\"value\\" data-index=\\"count\\" key=\\"value\\" align=\\"flex-start\\">
175                            </lit-table-column>
176                            <lit-table-column title=\\"type\\" data-index=\\"stat_type\\" key=\\"type\\" align=\\"flex-start\\">
177                            </lit-table-column>
178                    </lit-table>
179                </div>
180            </div>
181        </div>
182        "
183`);
184    });
185
186    it('SpInfoAndStasTest9', function () {
187        expect(spInfoAndStats.initMetricItemData()).toBeTruthy();
188    });
189
190
191
192})