• 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 {LitCheckBoxWithText} from "../../../dist/base-ui/checkbox/LitCheckBoxWithText.js";
18
19describe('checkBoxWithText Test', ()=>{
20
21    it('checkBoxWithTextTest01', function () {
22        let litCheckBoxWithText = new LitCheckBoxWithText();
23        expect(litCheckBoxWithText).not.toBeUndefined()
24        expect(litCheckBoxWithText).not.toBeNull()
25    });
26
27
28    it('checkBoxWithTextTest02', function () {
29        let litCheckBoxWithText = new LitCheckBoxWithText();
30        expect(litCheckBoxWithText.checked).toBeFalsy();
31    });
32
33    it('checkBoxWithTextTest03', function () {
34        let litCheckBoxWithText = new LitCheckBoxWithText();
35        litCheckBoxWithText.checked = true
36        expect(litCheckBoxWithText.checked).toBeTruthy();
37    });
38
39    it('checkBoxWithTextTest03', function () {
40        let litCheckBoxWithText = new LitCheckBoxWithText();
41        litCheckBoxWithText.checked = false
42        expect(litCheckBoxWithText.checked).toBeFalsy();
43    });
44
45    it('checkBoxWithTextTest04', function () {
46        let litCheckBoxWithText = new LitCheckBoxWithText();
47        expect(litCheckBoxWithText.text).toEqual("");
48    });
49
50    it('checkBoxWithTextTest05', function () {
51        let litCheckBoxWithText = new LitCheckBoxWithText();
52        litCheckBoxWithText.text = "test"
53        expect(litCheckBoxWithText.text).toEqual("test");
54    });
55
56    it('checkBoxWithTextTest05', function () {
57        let litCheckBoxWithText = new LitCheckBoxWithText();
58        expect(litCheckBoxWithText.lowerLimit).toEqual("0");
59    });
60
61    it('checkBoxWithTextTest05', function () {
62        let litCheckBoxWithText = new LitCheckBoxWithText();
63        litCheckBoxWithText.lowerLimit = "111"
64        expect(litCheckBoxWithText.lowerLimit).toEqual("111");
65    });
66
67    it('checkBoxWithTextTest05', function () {
68        let litCheckBoxWithText = new LitCheckBoxWithText();
69        litCheckBoxWithText.upLimit = "111"
70        expect(litCheckBoxWithText.upLimit).toEqual("111");
71    });
72
73    it('checkBoxWithTextTest05', function () {
74        let litCheckBoxWithText = new LitCheckBoxWithText();
75        expect(litCheckBoxWithText.initHtml()).toMatchInlineSnapshot(`
76"
77        <style>
78        :host{
79         display: grid;
80         grid-template-columns: 1fr min-content min-content;
81         grid-column-gap: 10px;
82         text-align: center;
83         height: 16px;
84        }
85        .input-style {
86          width: 48px;
87          height: 16px;
88          border: 1px solid #B3B3B3;
89          text-align: center;
90        }
91
92        </style>
93        <check-des-box id ='checkbox' value=\\"\\"></check-des-box>
94        <input class=\\"input-style\\" id=\\"textLowerLimit\\" value=\\"0\\"/>
95        <input class=\\"input-style\\" id=\\"_upLimit\\" value=\\"∞\\"/>
96        "
97`);
98    });
99
100    it('checkBoxWithTextTest06', function () {
101        let litCheckBoxWithText = new LitCheckBoxWithText();
102        expect(litCheckBoxWithText.attributeChangedCallback("checked")).toBeUndefined();
103    });
104
105    it('checkBoxWithTextTest07', function () {
106        let litCheckBoxWithText = new LitCheckBoxWithText();
107        expect(litCheckBoxWithText.attributeChangedCallback("text")).toBeUndefined();
108    });
109
110    it('checkBoxWithTextTest08', function () {
111        let litCheckBoxWithText = new LitCheckBoxWithText();
112        expect(litCheckBoxWithText.attributeChangedCallback("lowerLimit")).toBeUndefined();
113    });
114
115    it('checkBoxWithTextTest09', function () {
116        let litCheckBoxWithText = new LitCheckBoxWithText();
117        expect(litCheckBoxWithText.attributeChangedCallback("upLimit")).toBeUndefined();
118    });
119})