@dimailn/vuetify 2.7.2-alpha29 → 2.7.2-alpha31
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.
- package/dist/vuetify.js +166 -78
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +1 -1
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VBreadcrumbs/VBreadcrumbs.js +8 -6
- package/es5/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
- package/es5/components/VBreadcrumbs/VBreadcrumbsItem.js +4 -0
- package/es5/components/VBreadcrumbs/VBreadcrumbsItem.js.map +1 -1
- package/es5/components/VCarousel/VCarousel.js +14 -2
- package/es5/components/VCarousel/VCarousel.js.map +1 -1
- package/es5/components/VDialog/VDialog.js +47 -26
- package/es5/components/VDialog/VDialog.js.map +1 -1
- package/es5/components/VFileInput/VFileInput.js +50 -28
- package/es5/components/VFileInput/VFileInput.js.map +1 -1
- package/es5/components/VPagination/VPagination.js +15 -18
- package/es5/components/VPagination/VPagination.js.map +1 -1
- package/es5/components/VRangeSlider/VRangeSlider.js +57 -32
- package/es5/components/VRangeSlider/VRangeSlider.js.map +1 -1
- package/es5/components/VSubheader/VSubheader.js +1 -1
- package/es5/components/VSubheader/VSubheader.js.map +1 -1
- package/es5/components/VTreeview/VTreeview.js +26 -13
- package/es5/components/VTreeview/VTreeview.js.map +1 -1
- package/es5/components/VTreeview/VTreeviewNode.js +0 -2
- package/es5/components/VTreeview/VTreeviewNode.js.map +1 -1
- package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
- package/es5/framework.js +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbs.js +7 -5
- package/lib/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.js +4 -0
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.js.map +1 -1
- package/lib/components/VCarousel/VCarousel.js +14 -2
- package/lib/components/VCarousel/VCarousel.js.map +1 -1
- package/lib/components/VDialog/VDialog.js +9 -2
- package/lib/components/VDialog/VDialog.js.map +1 -1
- package/lib/components/VFileInput/VFileInput.js +43 -26
- package/lib/components/VFileInput/VFileInput.js.map +1 -1
- package/lib/components/VPagination/VPagination.js +15 -19
- package/lib/components/VPagination/VPagination.js.map +1 -1
- package/lib/components/VRangeSlider/VRangeSlider.js +16 -4
- package/lib/components/VRangeSlider/VRangeSlider.js.map +1 -1
- package/lib/components/VSubheader/VSubheader.js +1 -1
- package/lib/components/VSubheader/VSubheader.js.map +1 -1
- package/lib/components/VTreeview/VTreeview.js +15 -7
- package/lib/components/VTreeview/VTreeview.js.map +1 -1
- package/lib/components/VTreeview/VTreeviewNode.js +0 -2
- package/lib/components/VTreeview/VTreeviewNode.js.map +1 -1
- package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
- package/lib/framework.js +1 -1
- package/package.json +1 -1
- package/src/components/VBottomNavigation/__tests__/VBottomNavigation.spec.ts +43 -37
- package/src/components/VBottomNavigation/__tests__/__snapshots__/VBottomNavigation.spec.ts.snap +11 -10
- package/src/components/VBreadcrumbs/VBreadcrumbs.ts +8 -4
- package/src/components/VBreadcrumbs/VBreadcrumbsItem.ts +4 -0
- package/src/components/VBreadcrumbs/__tests__/VBreadcrumbs.spec.ts +125 -10
- package/src/components/VBreadcrumbs/__tests__/VBreadcrumbsItem.spec.ts +10 -6
- package/src/components/VBtnToggle/__tests__/VBtnToggle.spec.ts +10 -6
- package/src/components/VCarousel/VCarousel.ts +15 -3
- package/src/components/VCarousel/__tests__/VCarousel.spec.ts +74 -54
- package/src/components/VCarousel/__tests__/VCarouselItem.spec.ts +9 -5
- package/src/components/VCarousel/__tests__/__snapshots__/VCarousel.spec.ts.snap +1 -1
- package/src/components/VDialog/VDialog.ts +14 -4
- package/src/components/VDialog/__tests__/VDialog.spec.ts +105 -101
- package/src/components/VDialog/__tests__/__snapshots__/VDialog.spec.ts.snap +0 -15
- package/src/components/VExpansionPanel/__tests__/VExpansionPanel.spec.ts +43 -27
- package/src/components/VExpansionPanel/__tests__/__snapshots__/VExpansionPanel.spec.ts.snap +18 -16
- package/src/components/VFileInput/VFileInput.ts +46 -33
- package/src/components/VFileInput/__tests__/VFileInput.spec.ts +84 -54
- package/src/components/VFileInput/__tests__/__snapshots__/VFileInput.spec.ts.snap +242 -146
- package/src/components/VImg/__tests__/VImg.spec.ts +21 -20
- package/src/components/VImg/__tests__/__snapshots__/VImg.spec.ts.snap +16 -11
- package/src/components/VNavigationDrawer/__tests__/VNavigationDrawer.spec.ts +84 -71
- package/src/components/VPagination/VPagination.ts +16 -19
- package/src/components/VPagination/__tests__/VPagination.spec.ts +85 -71
- package/src/components/VPagination/__tests__/__snapshots__/VPagination.spec.ts.snap +184 -429
- package/src/components/VRangeSlider/VRangeSlider.ts +19 -4
- package/src/components/VRangeSlider/__tests__/VRangeSlider.spec.ts +40 -40
- package/src/components/VRangeSlider/__tests__/__snapshots__/VRangeSlider.spec.ts.snap +32 -38
- package/src/components/VSubheader/VSubheader.ts +1 -1
- package/src/components/VSubheader/__tests__/VSubheader.spec.ts +12 -7
- package/src/components/VSubheader/__tests__/__snapshots__/VSubheader.spec.ts.snap +1 -1
- package/src/components/VSystemBar/__tests__/VSystemBar.spec.ts +89 -17
- package/src/components/VTimeline/__tests__/VTimelineItem.spec.ts +25 -35
- package/src/components/VTimeline/__tests__/__snapshots__/VTimelineItem.spec.ts.snap +4 -5
- package/src/components/VTreeview/VTreeview.ts +20 -12
- package/src/components/VTreeview/VTreeviewNode.ts +0 -2
- package/src/components/VTreeview/__tests__/VTreeview.spec.ts +168 -174
- package/src/components/VTreeview/__tests__/VTreeviewNode.spec.ts +77 -66
- package/src/components/VTreeview/__tests__/__snapshots__/VTreeview.spec.ts.snap +141 -141
- package/src/components/VTreeview/__tests__/__snapshots__/VTreeviewNode.spec.ts.snap +26 -51
- package/src/components/VVirtualScroll/VVirtualScroll.ts +0 -1
- package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +6 -9
- package/src/components/VWindow/__tests__/VWindow.spec.ts +78 -0
- package/src/components/VWindow/__tests__/VWindowItem.spec.ts +127 -0
- package/src/components/VWindow/__tests__/__snapshots__/VWindow.spec.ts.snap +59 -0
- package/src/components/VWindow/__tests__/__snapshots__/VWindowItem.spec.ts.snap +36 -0
|
@@ -77,7 +77,7 @@ export default defineComponent({
|
|
|
77
77
|
} as PropValidator<File | File[]>,
|
|
78
78
|
},
|
|
79
79
|
|
|
80
|
-
emits: ['change', 'keydown'],
|
|
80
|
+
emits: ['change', 'keydown', 'click:prepend'],
|
|
81
81
|
|
|
82
82
|
computed: {
|
|
83
83
|
classes (): object {
|
|
@@ -104,7 +104,7 @@ export default defineComponent({
|
|
|
104
104
|
)
|
|
105
105
|
},
|
|
106
106
|
internalArrayValue (): File[] {
|
|
107
|
-
return wrapInArray(this.internalValue)
|
|
107
|
+
return wrapInArray(this.internalValue).filter((v: any) => v instanceof File)
|
|
108
108
|
},
|
|
109
109
|
internalValue: {
|
|
110
110
|
get (): File[] {
|
|
@@ -179,37 +179,46 @@ export default defineComponent({
|
|
|
179
179
|
const internalValue = this.internalValue
|
|
180
180
|
internalValue.splice(index, 1)
|
|
181
181
|
this.internalValue = internalValue // Trigger the watcher
|
|
182
|
-
}
|
|
182
|
+
},
|
|
183
183
|
}, [text]))
|
|
184
184
|
},
|
|
185
185
|
genControl () {
|
|
186
186
|
const render = VTextField.methods.genControl.call(this)
|
|
187
187
|
|
|
188
188
|
if (this.hideInput) {
|
|
189
|
-
render.
|
|
190
|
-
render.style,
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
if (render.props) {
|
|
190
|
+
render.props.style = mergeStyles(render.props.style, {
|
|
191
|
+
display: 'none',
|
|
192
|
+
})
|
|
193
|
+
} else {
|
|
194
|
+
render.props = {
|
|
195
|
+
style: { display: 'none' },
|
|
196
|
+
}
|
|
197
|
+
}
|
|
193
198
|
}
|
|
194
199
|
|
|
195
200
|
return render
|
|
196
201
|
},
|
|
197
202
|
genInput () {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
203
|
+
// Create input without calling VTextField.genInput to avoid value setting
|
|
204
|
+
const listeners = Object.assign({}, this.listeners$)
|
|
205
|
+
delete listeners.change // Change should not be bound externally
|
|
206
|
+
const { title, value, ...inputAttrs } = this.attrs$
|
|
207
|
+
|
|
208
|
+
const input = h('input', {
|
|
209
|
+
...inputAttrs,
|
|
210
|
+
autofocus: this.autofocus,
|
|
211
|
+
disabled: this.isDisabled,
|
|
212
|
+
id: this.computedId,
|
|
213
|
+
placeholder: this.placeholder,
|
|
214
|
+
readonly: this.isReadonly,
|
|
215
|
+
type: this.type,
|
|
216
|
+
multiple: this.multiple,
|
|
217
|
+
...listeners,
|
|
218
|
+
onChange: this.onInput,
|
|
219
|
+
onKeyDown: this.onKeyDown,
|
|
220
|
+
ref: 'input',
|
|
221
|
+
})
|
|
213
222
|
|
|
214
223
|
return [this.genSelections(), input]
|
|
215
224
|
},
|
|
@@ -252,20 +261,24 @@ export default defineComponent({
|
|
|
252
261
|
class: ['v-file-input__text', {
|
|
253
262
|
'v-file-input__text--placeholder': this.placeholder && !this.isDirty,
|
|
254
263
|
'v-file-input__text--chips': this.hasChips && !this.$slots.selection,
|
|
255
|
-
}]
|
|
264
|
+
}],
|
|
256
265
|
}, children)
|
|
257
266
|
},
|
|
258
267
|
genTextFieldSlot () {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
268
|
+
return h('div', {
|
|
269
|
+
class: 'v-text-field__slot',
|
|
270
|
+
onClick: (e: MouseEvent) => {
|
|
271
|
+
// Clicking the label already delegates to input element, so we shouldn't click it twice
|
|
272
|
+
if (e.target && (e.target as HTMLElement).nodeName === 'LABEL') return
|
|
273
|
+
|
|
274
|
+
this.$refs.input.click()
|
|
275
|
+
},
|
|
276
|
+
}, [
|
|
277
|
+
this.genLabel(),
|
|
278
|
+
this.prefix ? this.genAffix('prefix') : null,
|
|
279
|
+
this.genInput(),
|
|
280
|
+
this.suffix ? this.genAffix('suffix') : null,
|
|
281
|
+
])
|
|
269
282
|
},
|
|
270
283
|
onInput (e: Event) {
|
|
271
284
|
const files = [...(e.target as HTMLInputElement).files || []]
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
import VFileInput from '../VFileInput'
|
|
3
3
|
|
|
4
|
-
// Services
|
|
5
|
-
import { Lang } from '../../../services/lang'
|
|
6
|
-
|
|
7
4
|
// Preset
|
|
8
5
|
import { preset } from '../../../presets/default'
|
|
9
6
|
|
|
10
7
|
// Libraries
|
|
11
8
|
import {
|
|
12
|
-
|
|
9
|
+
VueWrapper,
|
|
13
10
|
mount,
|
|
14
|
-
|
|
11
|
+
config,
|
|
12
|
+
MountingOptions,
|
|
13
|
+
enableAutoUnmount,
|
|
15
14
|
} from '@vue/test-utils'
|
|
16
15
|
|
|
17
16
|
const oneMBFile = new File([new ArrayBuffer(1048576)], 'test')
|
|
@@ -19,19 +18,23 @@ const twoMBFile = new File([new ArrayBuffer(2097152)], 'test')
|
|
|
19
18
|
|
|
20
19
|
describe('VFileInput.ts', () => {
|
|
21
20
|
type Instance = InstanceType<typeof VFileInput>
|
|
22
|
-
let mountFunction: (options?:
|
|
21
|
+
let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
|
|
22
|
+
|
|
23
|
+
enableAutoUnmount(afterEach)
|
|
23
24
|
|
|
24
25
|
beforeEach(() => {
|
|
25
|
-
mountFunction = (options?:
|
|
26
|
+
mountFunction = (options?: MountingOptions<Instance>) => {
|
|
26
27
|
return mount(VFileInput, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
...options,
|
|
29
|
+
props: {
|
|
30
|
+
label: 'File input',
|
|
31
|
+
...options?.props,
|
|
32
|
+
},
|
|
33
|
+
global: {
|
|
34
|
+
mocks: {
|
|
35
|
+
...config.global.mocks,
|
|
32
36
|
},
|
|
33
37
|
},
|
|
34
|
-
...options,
|
|
35
38
|
})
|
|
36
39
|
}
|
|
37
40
|
})
|
|
@@ -44,7 +47,7 @@ describe('VFileInput.ts', () => {
|
|
|
44
47
|
|
|
45
48
|
it('should render multiple', () => {
|
|
46
49
|
const wrapper = mountFunction({
|
|
47
|
-
|
|
50
|
+
props: { multiple: true },
|
|
48
51
|
})
|
|
49
52
|
|
|
50
53
|
expect(wrapper.html()).toMatchSnapshot()
|
|
@@ -52,44 +55,44 @@ describe('VFileInput.ts', () => {
|
|
|
52
55
|
|
|
53
56
|
it('should render counter', () => {
|
|
54
57
|
const wrapper = mountFunction({
|
|
55
|
-
|
|
58
|
+
props: {
|
|
56
59
|
counter: true,
|
|
57
|
-
|
|
60
|
+
modelValue: [oneMBFile],
|
|
58
61
|
},
|
|
59
62
|
})
|
|
60
63
|
|
|
61
64
|
expect(wrapper.html()).toMatchSnapshot()
|
|
62
65
|
})
|
|
63
66
|
|
|
64
|
-
it('should display file size', () => {
|
|
67
|
+
it('should display file size', async () => {
|
|
65
68
|
const wrapper = mountFunction({
|
|
66
|
-
|
|
69
|
+
props: {
|
|
67
70
|
showSize: true,
|
|
68
|
-
|
|
71
|
+
modelValue: [twoMBFile],
|
|
69
72
|
},
|
|
70
73
|
})
|
|
71
74
|
|
|
72
75
|
expect(wrapper.html()).toMatchSnapshot()
|
|
73
76
|
|
|
74
|
-
wrapper.setProps({
|
|
77
|
+
await wrapper.setProps({
|
|
75
78
|
showSize: 1000,
|
|
76
79
|
})
|
|
77
80
|
|
|
78
81
|
expect(wrapper.html()).toMatchSnapshot()
|
|
79
82
|
})
|
|
80
83
|
|
|
81
|
-
it('should display total size in counter', () => {
|
|
84
|
+
it('should display total size in counter', async () => {
|
|
82
85
|
const wrapper = mountFunction({
|
|
83
|
-
|
|
86
|
+
props: {
|
|
84
87
|
showSize: true,
|
|
85
88
|
counter: true,
|
|
86
|
-
|
|
89
|
+
modelValue: [oneMBFile, twoMBFile],
|
|
87
90
|
},
|
|
88
91
|
})
|
|
89
92
|
|
|
90
93
|
expect(wrapper.html()).toMatchSnapshot()
|
|
91
94
|
|
|
92
|
-
wrapper.setProps({
|
|
95
|
+
await wrapper.setProps({
|
|
93
96
|
showSize: 1000,
|
|
94
97
|
})
|
|
95
98
|
|
|
@@ -98,7 +101,7 @@ describe('VFileInput.ts', () => {
|
|
|
98
101
|
|
|
99
102
|
it('should be unclearable', () => {
|
|
100
103
|
const wrapper = mountFunction({
|
|
101
|
-
|
|
104
|
+
props: {
|
|
102
105
|
clearable: false,
|
|
103
106
|
},
|
|
104
107
|
})
|
|
@@ -108,7 +111,7 @@ describe('VFileInput.ts', () => {
|
|
|
108
111
|
|
|
109
112
|
it('should work with accept', () => {
|
|
110
113
|
const wrapper = mountFunction({
|
|
111
|
-
|
|
114
|
+
props: {
|
|
112
115
|
accept: 'image/*',
|
|
113
116
|
},
|
|
114
117
|
})
|
|
@@ -118,12 +121,12 @@ describe('VFileInput.ts', () => {
|
|
|
118
121
|
|
|
119
122
|
it('should disable file input', () => {
|
|
120
123
|
const wrapper = mountFunction({
|
|
121
|
-
|
|
124
|
+
props: {
|
|
122
125
|
disabled: true,
|
|
123
126
|
},
|
|
124
127
|
})
|
|
125
128
|
|
|
126
|
-
expect(wrapper.find('input').element.
|
|
129
|
+
expect(wrapper.find('input').element.disabled).toBe(true)
|
|
127
130
|
})
|
|
128
131
|
|
|
129
132
|
it('should proxy icon and text click to input', () => {
|
|
@@ -144,7 +147,7 @@ describe('VFileInput.ts', () => {
|
|
|
144
147
|
|
|
145
148
|
it('should clear', () => {
|
|
146
149
|
const wrapper = mountFunction({
|
|
147
|
-
|
|
150
|
+
props: { modelValue: oneMBFile },
|
|
148
151
|
})
|
|
149
152
|
|
|
150
153
|
wrapper.vm.clearableCallback()
|
|
@@ -152,7 +155,7 @@ describe('VFileInput.ts', () => {
|
|
|
152
155
|
|
|
153
156
|
const wrapper2 = mountFunction({
|
|
154
157
|
attrs: { multiple: '' },
|
|
155
|
-
|
|
158
|
+
props: { modelValue: oneMBFile },
|
|
156
159
|
})
|
|
157
160
|
|
|
158
161
|
wrapper2.vm.clearableCallback()
|
|
@@ -163,7 +166,7 @@ describe('VFileInput.ts', () => {
|
|
|
163
166
|
const wrapper = mountFunction()
|
|
164
167
|
|
|
165
168
|
wrapper.setProps({
|
|
166
|
-
|
|
169
|
+
modelValue: [oneMBFile],
|
|
167
170
|
})
|
|
168
171
|
|
|
169
172
|
await wrapper.vm.$nextTick()
|
|
@@ -173,9 +176,9 @@ describe('VFileInput.ts', () => {
|
|
|
173
176
|
|
|
174
177
|
it('should render chips', () => {
|
|
175
178
|
const wrapper = mountFunction({
|
|
176
|
-
|
|
179
|
+
props: {
|
|
177
180
|
chips: true,
|
|
178
|
-
|
|
181
|
+
modelValue: [oneMBFile],
|
|
179
182
|
},
|
|
180
183
|
})
|
|
181
184
|
|
|
@@ -184,7 +187,7 @@ describe('VFileInput.ts', () => {
|
|
|
184
187
|
|
|
185
188
|
it('should render small chips', () => {
|
|
186
189
|
const wrapper = mountFunction({
|
|
187
|
-
|
|
190
|
+
props: {
|
|
188
191
|
smallChips: true,
|
|
189
192
|
},
|
|
190
193
|
data: () => ({
|
|
@@ -198,7 +201,7 @@ describe('VFileInput.ts', () => {
|
|
|
198
201
|
// https://github.com/vuetifyjs/vuetify/issues/8049
|
|
199
202
|
it('should render without icon', () => {
|
|
200
203
|
const wrapper = mountFunction({
|
|
201
|
-
|
|
204
|
+
props: {
|
|
202
205
|
prependIcon: '',
|
|
203
206
|
},
|
|
204
207
|
})
|
|
@@ -208,12 +211,7 @@ describe('VFileInput.ts', () => {
|
|
|
208
211
|
|
|
209
212
|
// https://github.com/vuetifyjs/vuetify/issues/8167
|
|
210
213
|
it('should not emit change event when blurred', async () => {
|
|
211
|
-
const
|
|
212
|
-
const wrapper = mountFunction({
|
|
213
|
-
listeners: {
|
|
214
|
-
change,
|
|
215
|
-
},
|
|
216
|
-
})
|
|
214
|
+
const wrapper = mountFunction()
|
|
217
215
|
|
|
218
216
|
const input = wrapper.find('input')
|
|
219
217
|
|
|
@@ -226,31 +224,26 @@ describe('VFileInput.ts', () => {
|
|
|
226
224
|
input.trigger('blur')
|
|
227
225
|
await wrapper.vm.$nextTick()
|
|
228
226
|
|
|
229
|
-
expect(change).
|
|
227
|
+
expect(wrapper.emitted('change')).toHaveLength(1)
|
|
230
228
|
})
|
|
231
229
|
|
|
232
230
|
it('should not emit change event when pressing enter', async () => {
|
|
233
|
-
const
|
|
234
|
-
const wrapper = mountFunction({
|
|
235
|
-
listeners: {
|
|
236
|
-
change,
|
|
237
|
-
},
|
|
238
|
-
})
|
|
231
|
+
const wrapper = mountFunction()
|
|
239
232
|
|
|
240
233
|
const input = wrapper.find('input')
|
|
241
234
|
|
|
242
235
|
input.trigger('keydown.enter')
|
|
243
236
|
await wrapper.vm.$nextTick()
|
|
244
237
|
|
|
245
|
-
expect(change).
|
|
238
|
+
expect(wrapper.emitted('change')).toBeFalsy()
|
|
246
239
|
})
|
|
247
240
|
|
|
248
241
|
it('should truncate correctly', async () => {
|
|
249
242
|
const fifteenCharFile = new File(['V'.repeat(15)], 'testFile15Chars')
|
|
250
243
|
const wrapper = mountFunction({
|
|
251
|
-
|
|
244
|
+
props: {
|
|
252
245
|
truncateLength: 1,
|
|
253
|
-
|
|
246
|
+
modelValue: fifteenCharFile,
|
|
254
247
|
},
|
|
255
248
|
})
|
|
256
249
|
|
|
@@ -281,13 +274,13 @@ describe('VFileInput.ts', () => {
|
|
|
281
274
|
expect(wrapper.find('.v-file-input__text').text()).toBe('test…hars')
|
|
282
275
|
})
|
|
283
276
|
|
|
284
|
-
it('should filter internal array values for instanceof File', () => {
|
|
277
|
+
it('should filter internal array values for instanceof File', async () => {
|
|
285
278
|
const wrapper = mountFunction()
|
|
286
279
|
|
|
287
280
|
const values = [null, undefined, {}, [null], [undefined], [{}]]
|
|
288
281
|
|
|
289
282
|
for (const value of values) {
|
|
290
|
-
wrapper.setProps({ value })
|
|
283
|
+
await wrapper.setProps({ modelValue: value })
|
|
291
284
|
|
|
292
285
|
expect(wrapper.vm.internalArrayValue).toEqual([])
|
|
293
286
|
}
|
|
@@ -295,9 +288,46 @@ describe('VFileInput.ts', () => {
|
|
|
295
288
|
|
|
296
289
|
it('should set display none if hide-input prop is set', () => {
|
|
297
290
|
const wrapper = mountFunction({
|
|
298
|
-
|
|
291
|
+
props: { hideInput: true },
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
it('should hide control element when hideInput is true', () => {
|
|
298
|
+
const wrapper = mountFunction({
|
|
299
|
+
props: { hideInput: true },
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
// Проверяем, что control элемент имеет display: none
|
|
303
|
+
const control = wrapper.find('.v-input__control')
|
|
304
|
+
expect(control.element.style.display).toBe('none')
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
it('should not hide control element when hideInput is false', () => {
|
|
308
|
+
const wrapper = mountFunction({
|
|
309
|
+
props: { hideInput: false },
|
|
299
310
|
})
|
|
300
311
|
|
|
312
|
+
// Проверяем, что control элемент не скрыт
|
|
313
|
+
const control = wrapper.find('.v-input__control')
|
|
314
|
+
expect(control.element.style.display).toBe('')
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
it('should render with hideInput prop like original Vuetify', () => {
|
|
318
|
+
const wrapper = mountFunction({
|
|
319
|
+
props: {
|
|
320
|
+
hideInput: true,
|
|
321
|
+
accept: 'image/*',
|
|
322
|
+
label: 'File input'
|
|
323
|
+
},
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
// Проверяем, что control элемент скрыт
|
|
327
|
+
const control = wrapper.find('.v-input__control')
|
|
328
|
+
expect(control.element.style.display).toBe('none')
|
|
329
|
+
|
|
330
|
+
// Проверяем снимок для полного соответствия оригинальному Vuetify
|
|
301
331
|
expect(wrapper.html()).toMatchSnapshot()
|
|
302
332
|
})
|
|
303
333
|
})
|