aaa-ui-test 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aaa-ui-test might be problematic. Click here for more details.
- package/README.md +62 -0
- package/babel-plugin-on-demand-load/index.js +74 -0
- package/babel-plugin-on-demand-load/report.js +49 -0
- package/lib/index.css +2213 -0
- package/lib/index.js +10083 -0
- package/package.json +73 -0
- package/src/assets/css/common/_mixin.scss +130 -0
- package/src/assets/css/common/_var.scss +69 -0
- package/src/components/address/index.js +8 -0
- package/src/components/address/index.scss +72 -0
- package/src/components/address/src/address.vue +238 -0
- package/src/components/amount/index.js +6 -0
- package/src/components/amount/index.scss +88 -0
- package/src/components/amount/src/amount.vue +143 -0
- package/src/components/button/__tests__/__snapshots__/index.test.js.snap +7 -0
- package/src/components/button/__tests__/index.test.js +39 -0
- package/src/components/button/index.js +7 -0
- package/src/components/button/index.scss +83 -0
- package/src/components/button/src/button.vue +39 -0
- package/src/components/button-group/index.js +8 -0
- package/src/components/button-group/index.scss +37 -0
- package/src/components/button-group/src/button-group.vue +21 -0
- package/src/components/checkbox/index.js +8 -0
- package/src/components/checkbox/index.scss +47 -0
- package/src/components/checkbox/src/checkbox-group.vue +53 -0
- package/src/components/checkbox/src/checkbox.vue +153 -0
- package/src/components/date-selecter/index.js +6 -0
- package/src/components/date-selecter/index.scss +190 -0
- package/src/components/date-selecter/src/dateselecter.vue +387 -0
- package/src/components/default/index.js +6 -0
- package/src/components/default/index.scss +25 -0
- package/src/components/default/src/default.vue +23 -0
- package/src/components/dialog/index.js +146 -0
- package/src/components/dialog/index.scss +250 -0
- package/src/components/dialog/src/dialog.vue +153 -0
- package/src/components/field/index.js +8 -0
- package/src/components/field/index.scss +93 -0
- package/src/components/field/src/field.vue +57 -0
- package/src/components/input/__tests__/__snapshots__/index.test.js.snap +10 -0
- package/src/components/input/__tests__/index.test.js +63 -0
- package/src/components/input/index.js +8 -0
- package/src/components/input/index.scss +91 -0
- package/src/components/input/src/input.vue +214 -0
- package/src/components/list/index.js +8 -0
- package/src/components/list/index.scss +21 -0
- package/src/components/list/src/list.vue +16 -0
- package/src/components/list-item/index.js +8 -0
- package/src/components/list-item/index.scss +126 -0
- package/src/components/list-item/src/list-item.vue +59 -0
- package/src/components/loading/__tests__/__snapshots__/index.test.js.snap +9 -0
- package/src/components/loading/__tests__/index.test.js +30 -0
- package/src/components/loading/index.js +128 -0
- package/src/components/loading/index.scss +33 -0
- package/src/components/loading/src/loading.vue +23 -0
- package/src/components/mask/index.js +9 -0
- package/src/components/mask/index.scss +16 -0
- package/src/components/mask/src/mask.vue +52 -0
- package/src/components/notice/index.js +6 -0
- package/src/components/notice/index.scss +81 -0
- package/src/components/notice/src/notice.vue +128 -0
- package/src/components/overlay/index.js +8 -0
- package/src/components/overlay/index.scss +119 -0
- package/src/components/overlay/src/overlay.vue +72 -0
- package/src/components/picker/index.js +7 -0
- package/src/components/picker/index.scss +49 -0
- package/src/components/picker/src/picker.vue +205 -0
- package/src/components/popup/index.js +8 -0
- package/src/components/popup/index.scss +79 -0
- package/src/components/popup/src/popup.vue +88 -0
- package/src/components/popup-header/index.js +8 -0
- package/src/components/popup-header/index.scss +45 -0
- package/src/components/popup-header/src/popup-header.vue +41 -0
- package/src/components/radio/index.js +8 -0
- package/src/components/radio/index.scss +19 -0
- package/src/components/radio/src/radio.vue +51 -0
- package/src/components/select/index.js +8 -0
- package/src/components/select/index.scss +51 -0
- package/src/components/select/src/select.vue +86 -0
- package/src/components/swiper/index.js +6 -0
- package/src/components/swiper/index.scss +49 -0
- package/src/components/swiper/src/swiper.vue +211 -0
- package/src/components/switch/__tests__/__snapshots__/index.test.js.snap +15 -0
- package/src/components/switch/__tests__/index.test.js +44 -0
- package/src/components/switch/index.js +8 -0
- package/src/components/switch/index.scss +85 -0
- package/src/components/switch/src/switch.vue +60 -0
- package/src/components/tabs/index.js +8 -0
- package/src/components/tabs/index.scss +73 -0
- package/src/components/tabs/src/tab-item.vue +40 -0
- package/src/components/tabs/src/tabs.vue +121 -0
- package/src/components/textarea/index.js +8 -0
- package/src/components/textarea/index.scss +41 -0
- package/src/components/textarea/src/textarea.vue +140 -0
- package/src/components/toast/__tests__/__snapshots__/index.test.js.snap +3 -0
- package/src/components/toast/__tests__/index.test.js +25 -0
- package/src/components/toast/index.js +53 -0
- package/src/components/toast/index.scss +102 -0
- package/src/components/toast/src/toast.vue +19 -0
- package/src/index.js +87 -0
- package/src/mixins/emitter.js +33 -0
- package/src/mixins/visible.js +23 -0
- package/src/utils/clickoutside.js +42 -0
- package/src/utils/fix-body.js +46 -0
- package/src/utils/utils.js +71 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Import the mount() method from the test utils
|
|
2
|
+
// and the component you want to test
|
|
3
|
+
import { mount } from "@vue/test-utils";
|
|
4
|
+
import Input from "..";
|
|
5
|
+
import asyncExpect from "@/../test/utils.js";
|
|
6
|
+
describe("Input", () => {
|
|
7
|
+
//let spy;
|
|
8
|
+
const mockFn = jest.fn();
|
|
9
|
+
// 设置 Wrapper vm 的方法并强制更新。
|
|
10
|
+
|
|
11
|
+
// Now mount the component and you have the wrapper
|
|
12
|
+
const wrapper = mount(Input, {
|
|
13
|
+
propsData: {
|
|
14
|
+
type: "text",
|
|
15
|
+
value: "",
|
|
16
|
+
title: "emaileamil",
|
|
17
|
+
placeholder: "email",
|
|
18
|
+
validateOption: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => {
|
|
21
|
+
return {
|
|
22
|
+
type: "email",
|
|
23
|
+
errorText: "请填写正确的邮箱号码",
|
|
24
|
+
pattern: ""
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
it("renders the correct markup", () => {
|
|
31
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
const getTask = async function() {
|
|
34
|
+
wrapper.trigger("click");
|
|
35
|
+
|
|
36
|
+
expect(wrapper.classes("jdd-field-focus")).toBe(true);
|
|
37
|
+
const textInput = wrapper.find("input");
|
|
38
|
+
//console.log(textInput.classes())
|
|
39
|
+
textInput.setValue("barbarbarbarbar");
|
|
40
|
+
expect(wrapper.vm.currentVal).toBe("barbarbarbarbar");
|
|
41
|
+
wrapper.setMethods({
|
|
42
|
+
cleanVal: mockFn
|
|
43
|
+
});
|
|
44
|
+
let clearIcon = wrapper.find(".jdd-field-clean-icon");
|
|
45
|
+
expect(clearIcon.isVisible()).toBe(true);
|
|
46
|
+
clearIcon.trigger("click");
|
|
47
|
+
await asyncExpect(() => {
|
|
48
|
+
expect(wrapper.vm.value).toBe("");
|
|
49
|
+
expect(wrapper.classes("jdd-field-error")).toBe(true);
|
|
50
|
+
}, 0);
|
|
51
|
+
};
|
|
52
|
+
it("has a correct class row", () => {
|
|
53
|
+
//expect(wrapper.classes()).toContain(['jdd-field-inline','jdd-field-common'])
|
|
54
|
+
expect(wrapper.classes("jdd-field-inline")).toBe(true);
|
|
55
|
+
expect(wrapper.classes("jdd-field-common")).toBe(true);
|
|
56
|
+
getTask();
|
|
57
|
+
});
|
|
58
|
+
it("has a correct class column", () => {
|
|
59
|
+
wrapper.setProps({ direction: "column" });
|
|
60
|
+
expect(wrapper.classes("jdd-field")).toBe(true);
|
|
61
|
+
getTask();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.jdd-field-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
|
|
5
|
+
input {
|
|
6
|
+
border: none;
|
|
7
|
+
outline: none;
|
|
8
|
+
appearance: none;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.jdd-field .jdd-field-input-with-icon {
|
|
13
|
+
padding-right: 32px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.jdd-field {
|
|
17
|
+
.jdd-field-input input {
|
|
18
|
+
text-align: left;
|
|
19
|
+
font-size: 18px;
|
|
20
|
+
font-family: PingFangSC-Medium;
|
|
21
|
+
font-weight:500;
|
|
22
|
+
color: #333333;
|
|
23
|
+
line-height: 22px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.jdd-field-icon-wrap {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0px;
|
|
29
|
+
bottom: 0px;
|
|
30
|
+
margin: auto 0px;
|
|
31
|
+
right: 16px;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
z-index: 1;
|
|
35
|
+
}
|
|
36
|
+
.jdd-field-control .jdd-field-disable {
|
|
37
|
+
color: #ccc;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.jdd-field {
|
|
42
|
+
input {
|
|
43
|
+
padding-right: 20px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.jdd-field-inline {
|
|
48
|
+
.jdd-field-icon-wrap {
|
|
49
|
+
display: flex;
|
|
50
|
+
}
|
|
51
|
+
.jdd-field-control .jdd-field-disable {
|
|
52
|
+
color: #ccc;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.jdd-field-control {
|
|
57
|
+
input {
|
|
58
|
+
font-family: PingFangSC-Regular;
|
|
59
|
+
font-size: 16px;
|
|
60
|
+
color: #333333;
|
|
61
|
+
letter-spacing: 0;
|
|
62
|
+
flex: 1;
|
|
63
|
+
text-align: right;
|
|
64
|
+
background-color: inherit;
|
|
65
|
+
width: 100%;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
|
|
68
|
+
&::placeholder {
|
|
69
|
+
font-family:PingFangSC-Regular,PingFang SC;
|
|
70
|
+
font-weight:400;
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
color: #cccccc;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.jdd-field-clean-icon {
|
|
77
|
+
width: 16px;
|
|
78
|
+
height: 16px;
|
|
79
|
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAqFJREFUWEfFmclOAzEMQFsWsS/iyFr2HQr8/1fBhQMIv1FThSEZO560RLJamCwvju143OHA34YydEtkU2RNZHUiYcZP+fIlwifyIfIu8u1fsmzkunQ/ERmLvBXKi/Q/nWywbNWC3mjtshCsayM3k9MoQOjuyhEfirxWhIw3MJJ5F/rSLskEVzMCjGHvZI0VLyxH/TgHyAD87LFdID3OUupc7f6Y165Vsxz3wxw12YYlMmxosDjO9T9CBmhMDoVlG96tHd+ToY82B/ao9SHeJhuBXAtBZ9KHUMKntlDu+cVkDkC0ObZTpEzQNRA4TIPGpweWNeI5NNjbNija7ILEucICYWwpbAwZ5uB0NFPaiWG5u7VjwH7bzQqbgmTsuWFd+jSNXVmMm414YPtAsiZ+00QA0jRNm/HzEti+kGHdPUD3C0GtmiXTStm15bjbijsG1DNQg60JyVqkhIN7h0bDjnNmUEuTccJidqScHadg4+hg9W7NT9TbSJsgZwbA1oJkjSqgKZsMoJ4bLKWc3kefgwzHb70UtJPr5Uw5745ttIZmuZDc4QnI9ktZsMmSS0HT5DQ8eQJ+F6QWujw22wT80ivUAlkbtrlCS5KSEshasNOkBFhLmueBrAE7TfMA1RJnktuc41icIXcpFCfOwGp1pVGUDXlvnDgaWOIrFZQ/zfJyByxa8GZcQbMWSPr+eg2JiY/kD+0otXccbTzPLQUOwli2sVNyP8tis+yjFiDYAe8nNbTm3YippBNUjb0ywLuYd1xRkSzAUqiad9kxWRnpstXwbHlONotzuQu5AZZwRDTQ6lLe46ass2jRmrUPO/ZkPrkNcMHgCzNr2C65gScyjGXczH++Se2cH8QORNAOlbe4NETU4H/8WMHViaO0X6PN2vwBXtDwHrylQ1oAAAAASUVORK5CYII=");
|
|
80
|
+
background-position: left center;
|
|
81
|
+
background-repeat: no-repeat;
|
|
82
|
+
background-size: 16px;
|
|
83
|
+
transition-property: opacity, transform;
|
|
84
|
+
transition-timing-function: ease-out;
|
|
85
|
+
transition-duration: 0.3s;
|
|
86
|
+
margin-left: 8px;
|
|
87
|
+
display: block;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<jdd-field
|
|
3
|
+
:label="label"
|
|
4
|
+
:state="validateStatus"
|
|
5
|
+
:isFocus="getFocus"
|
|
6
|
+
:direction="direction"
|
|
7
|
+
@label-click="onLabelclick"
|
|
8
|
+
:border="border"
|
|
9
|
+
|
|
10
|
+
>
|
|
11
|
+
<!-- <div class="jdd-input-wrap" :class="{ 'jdd-input-focus': isInputFocus }"> -->
|
|
12
|
+
<div
|
|
13
|
+
class="jdd-field-control jdd-field-input"
|
|
14
|
+
:class="{'jdd-field-input-with-icon':$slots.icon}"
|
|
15
|
+
>
|
|
16
|
+
<!-- <span class="jdd-field-placeholder" v-show="!inputValue.length&&!isFocus" @click="focus">{{placeholder}}</span> -->
|
|
17
|
+
<input
|
|
18
|
+
:class="{'jdd-field-disable':$attrs.readonly}"
|
|
19
|
+
@input="onInput"
|
|
20
|
+
@focus="onFocus"
|
|
21
|
+
@blur ="onBlur"
|
|
22
|
+
@change="onChange"
|
|
23
|
+
v-model="currentVal"
|
|
24
|
+
:placeholder="getPlaceholder"
|
|
25
|
+
ref="input"
|
|
26
|
+
v-bind="$attrs"
|
|
27
|
+
>
|
|
28
|
+
<div class="jdd-field-icon-wrap">
|
|
29
|
+
<i
|
|
30
|
+
class="jdd-field-clean-icon"
|
|
31
|
+
@click.stop="cleanVal"
|
|
32
|
+
v-show="showClear"
|
|
33
|
+
></i>
|
|
34
|
+
<slot name="icon"></slot>
|
|
35
|
+
</div>
|
|
36
|
+
<!-- </div> -->
|
|
37
|
+
</div>
|
|
38
|
+
</jdd-field>
|
|
39
|
+
</template>
|
|
40
|
+
<script>
|
|
41
|
+
import jddField from "../../field";
|
|
42
|
+
// fix problem when page in pc mode clearicon click event trigger after input blur event
|
|
43
|
+
//import Clickoutside from '@/utils/clickoutside';
|
|
44
|
+
export default {
|
|
45
|
+
name: "JddInput",
|
|
46
|
+
inheritAttrs:false,
|
|
47
|
+
props: {
|
|
48
|
+
direction: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "row"
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ""
|
|
55
|
+
},
|
|
56
|
+
value: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ""
|
|
59
|
+
},
|
|
60
|
+
border: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: ""
|
|
63
|
+
},
|
|
64
|
+
placeholder: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ""
|
|
67
|
+
},
|
|
68
|
+
validateOption: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => {
|
|
71
|
+
return {
|
|
72
|
+
type: "",
|
|
73
|
+
errorText: "",
|
|
74
|
+
pattern: ""
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
// directives: {
|
|
80
|
+
// Clickoutside
|
|
81
|
+
// },
|
|
82
|
+
components: {
|
|
83
|
+
jddField
|
|
84
|
+
},
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
label: this.title,
|
|
88
|
+
currentVal: this.value,
|
|
89
|
+
isFocus: false,
|
|
90
|
+
pattern: "",
|
|
91
|
+
validateStatus: true,
|
|
92
|
+
// placeholderText: this.placeholder,
|
|
93
|
+
disabled:this.$attrs.readonly||this.$attrs.disabled
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
created() {
|
|
97
|
+
// if(this.value){
|
|
98
|
+
// this.isFocus = true;
|
|
99
|
+
// }
|
|
100
|
+
if (this.validateOption.pattern) {
|
|
101
|
+
this.pattern = this.validateOption.pattern;
|
|
102
|
+
} else {
|
|
103
|
+
switch (this.validateOption.type) {
|
|
104
|
+
case "mobile":
|
|
105
|
+
this.pattern = /^1\d{10}$/;
|
|
106
|
+
break;
|
|
107
|
+
case "email":
|
|
108
|
+
this.pattern = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
|
|
109
|
+
break;
|
|
110
|
+
|
|
111
|
+
default:
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
methods: {
|
|
117
|
+
onLabelclick() {
|
|
118
|
+
if (!this.disabled) {
|
|
119
|
+
this.isFocus = true;
|
|
120
|
+
this.$refs.input.focus();
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
validate() {
|
|
124
|
+
if (
|
|
125
|
+
this.validateOption.type === "mobile" ||
|
|
126
|
+
this.validateOption.type === "email"
|
|
127
|
+
) {
|
|
128
|
+
if (this.pattern.test(this.currentVal)) {
|
|
129
|
+
this.label = this.title;
|
|
130
|
+
this.validateStatus = true;
|
|
131
|
+
} else {
|
|
132
|
+
this.label = this.validateOption.errorText;
|
|
133
|
+
this.validateStatus = false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
// inputResetValidate() {
|
|
138
|
+
// if (this.validateOption.type === "mobile") {
|
|
139
|
+
// if (this.pattern.test(this.currentVal)) {
|
|
140
|
+
// this.validateStatus = false;
|
|
141
|
+
// this.placeholderText = this.placeholder;
|
|
142
|
+
// }
|
|
143
|
+
// }
|
|
144
|
+
// },
|
|
145
|
+
// focus() {
|
|
146
|
+
// //console.log(1)
|
|
147
|
+
// this.isFocus = true;
|
|
148
|
+
// this.active = true;
|
|
149
|
+
// //var _this = this;
|
|
150
|
+
// this.$res.input.focus();
|
|
151
|
+
// },
|
|
152
|
+
cleanVal() {
|
|
153
|
+
this.currentVal = "";
|
|
154
|
+
//this.formDom.focus();
|
|
155
|
+
this.$refs.input.focus();
|
|
156
|
+
this.$emit("input");
|
|
157
|
+
this.$emit("on-clean-value");
|
|
158
|
+
},
|
|
159
|
+
onFocus() {
|
|
160
|
+
this.isFocus = true;
|
|
161
|
+
//this.active = true;
|
|
162
|
+
},
|
|
163
|
+
onBlur() {
|
|
164
|
+
if(this.isFocus)
|
|
165
|
+
this.validate();
|
|
166
|
+
// if (
|
|
167
|
+
// (!this.currentVal && this.direction === "column") ||
|
|
168
|
+
// this.direction === "row"
|
|
169
|
+
// )
|
|
170
|
+
this.isFocus = false;
|
|
171
|
+
//this.active = false;
|
|
172
|
+
},
|
|
173
|
+
onChange() {
|
|
174
|
+
this.validate();
|
|
175
|
+
},
|
|
176
|
+
onInput() {
|
|
177
|
+
if(!this.validateStatus)
|
|
178
|
+
this.validate();
|
|
179
|
+
this.$emit("input", this.currentVal);
|
|
180
|
+
// if (this.validateOption.type) this.inputResetValidate();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
computed: {
|
|
184
|
+
isInputFocus() {
|
|
185
|
+
return this.isFocus || this.currentVal;
|
|
186
|
+
},
|
|
187
|
+
getPlaceholder() {
|
|
188
|
+
return this.direction !== "column" && this.placeholder;
|
|
189
|
+
},
|
|
190
|
+
showClear() {
|
|
191
|
+
return this.currentVal && !this.disabled && this.isFocus;
|
|
192
|
+
},
|
|
193
|
+
getFocus(){
|
|
194
|
+
return this.isFocus || this.currentVal !=='';
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
watch: {
|
|
198
|
+
value(newVal) {
|
|
199
|
+
if (newVal) {
|
|
200
|
+
this.isFocus = true;
|
|
201
|
+
}
|
|
202
|
+
this.currentVal = newVal;
|
|
203
|
+
},
|
|
204
|
+
currentVal(newVal) {
|
|
205
|
+
this.$emit("input", newVal);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
mounted() {
|
|
209
|
+
this.formDom = this.$el.querySelector("input");
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@charset "utf-8";
|
|
2
|
+
@import "~@/assets/css/common/var";
|
|
3
|
+
@import "~@/assets/css/common/mixin";
|
|
4
|
+
|
|
5
|
+
.jdd-list {
|
|
6
|
+
position: relative;
|
|
7
|
+
width: 100%;
|
|
8
|
+
margin-top: 20px;
|
|
9
|
+
&-title {
|
|
10
|
+
position: relative;
|
|
11
|
+
font-size: $sizeNormal;
|
|
12
|
+
color: $cMainWeak;
|
|
13
|
+
line-height: 1;
|
|
14
|
+
padding: 10px $baseNum;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-body {
|
|
18
|
+
position: relative;
|
|
19
|
+
background-color: $white;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jdd-list">
|
|
3
|
+
<div class="jdd-list-title" v-if="title" v-text="title"></div>
|
|
4
|
+
<div class="jdd-list-body">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: 'JddList',
|
|
12
|
+
props: {
|
|
13
|
+
title: String
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@charset "utf-8";
|
|
2
|
+
@import "~@/assets/css/common/var";
|
|
3
|
+
@import "~@/assets/css/common/mixin";
|
|
4
|
+
|
|
5
|
+
.jdd-list-item {
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding-left: 16px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
height: 56px;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
|
|
14
|
+
&.jdd-list-item-mheight {
|
|
15
|
+
height: 70px;
|
|
16
|
+
.jdd-list-item-icon {
|
|
17
|
+
img {
|
|
18
|
+
width: 44px;
|
|
19
|
+
height: 44px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&.jdd-list-item-diasbled {
|
|
24
|
+
.jdd-list-item-cont {
|
|
25
|
+
.title {
|
|
26
|
+
color: #ccc;
|
|
27
|
+
}
|
|
28
|
+
.desc {
|
|
29
|
+
color: #ccc;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.jdd-list-item-after {
|
|
33
|
+
color: #ccc;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
&-inner {
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100%;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
height: 100%;
|
|
42
|
+
padding-right: 16px;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
&-border-top{
|
|
48
|
+
@include jdd-border-top($borderColor)
|
|
49
|
+
}
|
|
50
|
+
&-border-bottom{
|
|
51
|
+
|
|
52
|
+
@include jdd-border-bottom();
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
&-icon {
|
|
56
|
+
margin-right: 12px;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
img {
|
|
61
|
+
display: block;
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&-cont {
|
|
68
|
+
flex: 1;
|
|
69
|
+
min-width: 0;
|
|
70
|
+
|
|
71
|
+
.title {
|
|
72
|
+
font-family: PingFangSC-Medium;
|
|
73
|
+
color: $cMainStrong;
|
|
74
|
+
font-size: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.desc {
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
color: #999999;
|
|
80
|
+
margin-top: 6px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&-after {
|
|
85
|
+
position: relative;
|
|
86
|
+
color: $cMainWeak;
|
|
87
|
+
text-align: right;
|
|
88
|
+
p{
|
|
89
|
+
font-family: PingFangSC-Regular;
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
color: #999999;
|
|
92
|
+
}
|
|
93
|
+
.arrow {
|
|
94
|
+
display: none;
|
|
95
|
+
height: 6px;
|
|
96
|
+
width: 6px;
|
|
97
|
+
border-width: 1px 1px 0 0;
|
|
98
|
+
border-color: $borderWeak;
|
|
99
|
+
border-style: solid;
|
|
100
|
+
transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
|
|
101
|
+
position: relative;
|
|
102
|
+
top: -2px;
|
|
103
|
+
position: absolute;
|
|
104
|
+
top: 50%;
|
|
105
|
+
margin-top: -4px;
|
|
106
|
+
right: 2px;
|
|
107
|
+
box-sizing: content-box;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
// 带尖头可点击,点击态背景色
|
|
113
|
+
.jdd-list-item-link {
|
|
114
|
+
|
|
115
|
+
.jdd-list-item-after {
|
|
116
|
+
padding-right: $baseNum;
|
|
117
|
+
.arrow {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
&:not(.jdd-list-item-diasbled) {
|
|
122
|
+
&:active {
|
|
123
|
+
background-color: #F2F2F2;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jdd-list-item" :class="[arrow && 'jdd-list-item-link', hasDesc && 'jdd-list-item-mheight', disabled && 'jdd-list-item-diasbled']" @click="onClick">
|
|
3
|
+
<div class="jdd-list-item-icon" v-if="hasIcon">
|
|
4
|
+
<slot name="icon"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="jdd-list-item-inner" :class="[border?'jdd-list-item-border-bottom':'',]">
|
|
7
|
+
<div class="jdd-list-item-cont">
|
|
8
|
+
<slot name="title">
|
|
9
|
+
<p class="title" v-text="title"></p>
|
|
10
|
+
</slot>
|
|
11
|
+
<slot name="desc">
|
|
12
|
+
<p v-if="desc" class="desc" v-text="desc"></p>
|
|
13
|
+
</slot>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="jdd-list-item-after" @click="valueClick">
|
|
16
|
+
<slot name="value"><p v-if="value" v-text="value"></p></slot>
|
|
17
|
+
<i class="arrow"></i>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
name: 'JddListItem',
|
|
25
|
+
props: {
|
|
26
|
+
arrow: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
title: String,
|
|
31
|
+
value: [String, Number, Array],
|
|
32
|
+
desc: String,
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
border:{
|
|
38
|
+
type: String,
|
|
39
|
+
default: "bottom"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
hasDesc: this.desc || (this.$slots.desc && this.$slots.desc.length > 0) ? true : false,
|
|
45
|
+
hasIcon: this.$slots.icon && this.$slots.icon.length > 0 ? true : false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
methods: {
|
|
49
|
+
onClick(target) {
|
|
50
|
+
if(target.target.tagName !== 'A'){
|
|
51
|
+
!this.disabled&&this.$emit("onClick")
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
valueClick(){
|
|
55
|
+
this.$emit("value-click")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Toast renders the correct markup 1`] = `
|
|
4
|
+
<div class="jdd-loading jdd-loading-fade-enter jdd-loading-fade-enter-active" style="">
|
|
5
|
+
<div class="jdd-mask-box" style="">
|
|
6
|
+
<div class="jdd-mask jdd-mask-transparent"></div>
|
|
7
|
+
</div> <img src="//m.jr.jd.com/statics/pageLoading/loading.svg">
|
|
8
|
+
</div>
|
|
9
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Import the mount() method from the test utils
|
|
2
|
+
// and the component you want to test
|
|
3
|
+
import { createWrapper } from "@vue/test-utils";
|
|
4
|
+
import Loading from "..";
|
|
5
|
+
import { flushPromises } from "@/../test/utils.js";
|
|
6
|
+
|
|
7
|
+
describe("Toast", () => {
|
|
8
|
+
const loading = Loading();
|
|
9
|
+
const wrapper = createWrapper(loading);
|
|
10
|
+
let dom = createWrapper(document.body);
|
|
11
|
+
|
|
12
|
+
it("renders the correct markup", async () => {
|
|
13
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
it("has a span class", async () => {
|
|
16
|
+
expect(wrapper.classes()).toContain("jdd-loading");
|
|
17
|
+
expect(wrapper.find(".jdd-mask-box").isVisible()).toBe(true);
|
|
18
|
+
await flushPromises();
|
|
19
|
+
expect(dom.find(".jdd-mask-box").exists()).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
it("timeout param is correct", async () => {
|
|
22
|
+
let timeLoading = Loading(2000);
|
|
23
|
+
await flushPromises();
|
|
24
|
+
expect(dom.find(".jdd-mask-box").exists()).toBe(true);
|
|
25
|
+
//await flushPromises(3000);
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
expect(dom.find(".jdd-mask-box").isVisible()).toBe(false);
|
|
28
|
+
}, 3000);
|
|
29
|
+
});
|
|
30
|
+
});
|