@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.
Files changed (95) hide show
  1. package/dist/vuetify.js +166 -78
  2. package/dist/vuetify.js.map +1 -1
  3. package/dist/vuetify.min.css +1 -1
  4. package/dist/vuetify.min.js +2 -2
  5. package/es5/components/VBreadcrumbs/VBreadcrumbs.js +8 -6
  6. package/es5/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
  7. package/es5/components/VBreadcrumbs/VBreadcrumbsItem.js +4 -0
  8. package/es5/components/VBreadcrumbs/VBreadcrumbsItem.js.map +1 -1
  9. package/es5/components/VCarousel/VCarousel.js +14 -2
  10. package/es5/components/VCarousel/VCarousel.js.map +1 -1
  11. package/es5/components/VDialog/VDialog.js +47 -26
  12. package/es5/components/VDialog/VDialog.js.map +1 -1
  13. package/es5/components/VFileInput/VFileInput.js +50 -28
  14. package/es5/components/VFileInput/VFileInput.js.map +1 -1
  15. package/es5/components/VPagination/VPagination.js +15 -18
  16. package/es5/components/VPagination/VPagination.js.map +1 -1
  17. package/es5/components/VRangeSlider/VRangeSlider.js +57 -32
  18. package/es5/components/VRangeSlider/VRangeSlider.js.map +1 -1
  19. package/es5/components/VSubheader/VSubheader.js +1 -1
  20. package/es5/components/VSubheader/VSubheader.js.map +1 -1
  21. package/es5/components/VTreeview/VTreeview.js +26 -13
  22. package/es5/components/VTreeview/VTreeview.js.map +1 -1
  23. package/es5/components/VTreeview/VTreeviewNode.js +0 -2
  24. package/es5/components/VTreeview/VTreeviewNode.js.map +1 -1
  25. package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  26. package/es5/framework.js +1 -1
  27. package/lib/components/VBreadcrumbs/VBreadcrumbs.js +7 -5
  28. package/lib/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
  29. package/lib/components/VBreadcrumbs/VBreadcrumbsItem.js +4 -0
  30. package/lib/components/VBreadcrumbs/VBreadcrumbsItem.js.map +1 -1
  31. package/lib/components/VCarousel/VCarousel.js +14 -2
  32. package/lib/components/VCarousel/VCarousel.js.map +1 -1
  33. package/lib/components/VDialog/VDialog.js +9 -2
  34. package/lib/components/VDialog/VDialog.js.map +1 -1
  35. package/lib/components/VFileInput/VFileInput.js +43 -26
  36. package/lib/components/VFileInput/VFileInput.js.map +1 -1
  37. package/lib/components/VPagination/VPagination.js +15 -19
  38. package/lib/components/VPagination/VPagination.js.map +1 -1
  39. package/lib/components/VRangeSlider/VRangeSlider.js +16 -4
  40. package/lib/components/VRangeSlider/VRangeSlider.js.map +1 -1
  41. package/lib/components/VSubheader/VSubheader.js +1 -1
  42. package/lib/components/VSubheader/VSubheader.js.map +1 -1
  43. package/lib/components/VTreeview/VTreeview.js +15 -7
  44. package/lib/components/VTreeview/VTreeview.js.map +1 -1
  45. package/lib/components/VTreeview/VTreeviewNode.js +0 -2
  46. package/lib/components/VTreeview/VTreeviewNode.js.map +1 -1
  47. package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  48. package/lib/framework.js +1 -1
  49. package/package.json +1 -1
  50. package/src/components/VBottomNavigation/__tests__/VBottomNavigation.spec.ts +43 -37
  51. package/src/components/VBottomNavigation/__tests__/__snapshots__/VBottomNavigation.spec.ts.snap +11 -10
  52. package/src/components/VBreadcrumbs/VBreadcrumbs.ts +8 -4
  53. package/src/components/VBreadcrumbs/VBreadcrumbsItem.ts +4 -0
  54. package/src/components/VBreadcrumbs/__tests__/VBreadcrumbs.spec.ts +125 -10
  55. package/src/components/VBreadcrumbs/__tests__/VBreadcrumbsItem.spec.ts +10 -6
  56. package/src/components/VBtnToggle/__tests__/VBtnToggle.spec.ts +10 -6
  57. package/src/components/VCarousel/VCarousel.ts +15 -3
  58. package/src/components/VCarousel/__tests__/VCarousel.spec.ts +74 -54
  59. package/src/components/VCarousel/__tests__/VCarouselItem.spec.ts +9 -5
  60. package/src/components/VCarousel/__tests__/__snapshots__/VCarousel.spec.ts.snap +1 -1
  61. package/src/components/VDialog/VDialog.ts +14 -4
  62. package/src/components/VDialog/__tests__/VDialog.spec.ts +105 -101
  63. package/src/components/VDialog/__tests__/__snapshots__/VDialog.spec.ts.snap +0 -15
  64. package/src/components/VExpansionPanel/__tests__/VExpansionPanel.spec.ts +43 -27
  65. package/src/components/VExpansionPanel/__tests__/__snapshots__/VExpansionPanel.spec.ts.snap +18 -16
  66. package/src/components/VFileInput/VFileInput.ts +46 -33
  67. package/src/components/VFileInput/__tests__/VFileInput.spec.ts +84 -54
  68. package/src/components/VFileInput/__tests__/__snapshots__/VFileInput.spec.ts.snap +242 -146
  69. package/src/components/VImg/__tests__/VImg.spec.ts +21 -20
  70. package/src/components/VImg/__tests__/__snapshots__/VImg.spec.ts.snap +16 -11
  71. package/src/components/VNavigationDrawer/__tests__/VNavigationDrawer.spec.ts +84 -71
  72. package/src/components/VPagination/VPagination.ts +16 -19
  73. package/src/components/VPagination/__tests__/VPagination.spec.ts +85 -71
  74. package/src/components/VPagination/__tests__/__snapshots__/VPagination.spec.ts.snap +184 -429
  75. package/src/components/VRangeSlider/VRangeSlider.ts +19 -4
  76. package/src/components/VRangeSlider/__tests__/VRangeSlider.spec.ts +40 -40
  77. package/src/components/VRangeSlider/__tests__/__snapshots__/VRangeSlider.spec.ts.snap +32 -38
  78. package/src/components/VSubheader/VSubheader.ts +1 -1
  79. package/src/components/VSubheader/__tests__/VSubheader.spec.ts +12 -7
  80. package/src/components/VSubheader/__tests__/__snapshots__/VSubheader.spec.ts.snap +1 -1
  81. package/src/components/VSystemBar/__tests__/VSystemBar.spec.ts +89 -17
  82. package/src/components/VTimeline/__tests__/VTimelineItem.spec.ts +25 -35
  83. package/src/components/VTimeline/__tests__/__snapshots__/VTimelineItem.spec.ts.snap +4 -5
  84. package/src/components/VTreeview/VTreeview.ts +20 -12
  85. package/src/components/VTreeview/VTreeviewNode.ts +0 -2
  86. package/src/components/VTreeview/__tests__/VTreeview.spec.ts +168 -174
  87. package/src/components/VTreeview/__tests__/VTreeviewNode.spec.ts +77 -66
  88. package/src/components/VTreeview/__tests__/__snapshots__/VTreeview.spec.ts.snap +141 -141
  89. package/src/components/VTreeview/__tests__/__snapshots__/VTreeviewNode.spec.ts.snap +26 -51
  90. package/src/components/VVirtualScroll/VVirtualScroll.ts +0 -1
  91. package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +6 -9
  92. package/src/components/VWindow/__tests__/VWindow.spec.ts +78 -0
  93. package/src/components/VWindow/__tests__/VWindowItem.spec.ts +127 -0
  94. package/src/components/VWindow/__tests__/__snapshots__/VWindow.spec.ts.snap +59 -0
  95. 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.style = mergeStyles(
190
- render.style,
191
- { display: 'none' }
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
- const input = VTextField.methods.genInput.call(this)
199
-
200
- input.multiple = this.multiple
201
-
202
- // We should not be setting value
203
- // programmatically on the input
204
- // when it is using type="file"
205
- delete input.value
206
-
207
- // This solves an issue in Safari where
208
- // nothing happens when adding a file
209
- // due to the input event not firing
210
- // https://github.com/vuetifyjs/vuetify/issues/7941
211
- delete input.onInput
212
- input.onChange = this.onInput
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
- const node = VTextField.methods.genTextFieldSlot.call(this)
260
-
261
- node.onClick = (e: MouseEvent) => {
262
- // Clicking the label already delegates to input element, so we shouldn't click it twice
263
- if (e.target && (e.target as HTMLElement).nodeName === 'LABEL') return
264
-
265
- this.$refs.input.click()
266
- }
267
-
268
- return node
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
- Wrapper,
9
+ VueWrapper,
13
10
  mount,
14
- MountOptions,
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?: MountOptions<Instance>) => Wrapper<Instance>
21
+ let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
22
+
23
+ enableAutoUnmount(afterEach)
23
24
 
24
25
  beforeEach(() => {
25
- mountFunction = (options?: MountOptions<Instance>) => {
26
+ mountFunction = (options?: MountingOptions<Instance>) => {
26
27
  return mount(VFileInput, {
27
- // https://github.com/vuejs/vue-test-utils/issues/1130
28
- sync: false,
29
- mocks: {
30
- $vuetify: {
31
- lang: new Lang(preset),
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
- propsData: { multiple: true },
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
- propsData: {
58
+ props: {
56
59
  counter: true,
57
- value: [oneMBFile],
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
- propsData: {
69
+ props: {
67
70
  showSize: true,
68
- value: [twoMBFile],
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
- propsData: {
86
+ props: {
84
87
  showSize: true,
85
88
  counter: true,
86
- value: [oneMBFile, twoMBFile],
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
- propsData: {
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
- propsData: {
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
- propsData: {
124
+ props: {
122
125
  disabled: true,
123
126
  },
124
127
  })
125
128
 
126
- expect(wrapper.find('input').element.getAttribute('disabled')).toBe('disabled')
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
- propsData: { value: oneMBFile },
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
- propsData: { value: oneMBFile },
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
- value: [oneMBFile],
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
- propsData: {
179
+ props: {
177
180
  chips: true,
178
- value: [oneMBFile],
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
- propsData: {
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
- propsData: {
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 change = jest.fn()
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).toHaveBeenCalledTimes(1)
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 change = jest.fn()
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).not.toHaveBeenCalled()
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
- propsData: {
244
+ props: {
252
245
  truncateLength: 1,
253
- value: fifteenCharFile,
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
- propsData: { hideInput: true },
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
  })