• 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 {LitProgressBar} from "../../../dist/base-ui/progress-bar/LitProgressBar.js";
18
19describe('LitProgressBar Test', ()=>{
20    let litProgressBar = new LitProgressBar();
21    litProgressBar.loading = ''
22    litProgressBar.loading = 'load'
23
24    it('LitProgressBarTest01', ()=>{
25        expect(litProgressBar.loading).toBeTruthy();
26    })
27
28    it('LitProgressBarTest02', ()=>{
29        expect(litProgressBar.initHtml()).toMatchInlineSnapshot(`
30"
31        <style>
32            :host{
33                width: 100%;
34                height: 1px;
35                display: flex;
36                position: absolute;
37                overflow: hidden;
38            }
39            .root{
40                width: 100%;
41                height: 100%;
42                position:relative;
43            }
44            :host([loading]) .track1{
45                position: absolute;
46                width: 30%;
47                height: 100%;
48                background-image: linear-gradient(to right,transparent,  #535da6, #535da6, #535da6, #535da6,#535da6,transparent);
49                left: -30%;
50                animation: anim 1.7s linear 0s infinite;
51            }
52            :host([loading]) .track2{
53                position: absolute;
54                width: 30%;
55                height: 100%;
56                background-image: linear-gradient(to right,transparent,  #535da6, #535da6, #535da6, #535da6,#535da6,transparent);
57                left: -30%;
58                animation: anim 1.7s  ease-in-out  0.7s infinite;
59            }
60            @keyframes anim {
61              0% {
62                left:-30%;
63              }
64
65              100% {
66                left:100%;
67              }
68            }
69
70        </style>
71        <div class=\\"root\\">
72            <div class=\\"track1\\"></div>
73            <div class=\\"track2\\"></div>
74        </div>
75        "
76`);
77    })
78})
79