@dimailn/vuetify 2.7.2-alpha27 → 2.7.2-alpha28

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 (127) hide show
  1. package/dist/vuetify.js +78 -22
  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/VAlert/VAlert.js +0 -1
  6. package/es5/components/VAlert/VAlert.js.map +1 -1
  7. package/es5/components/VChip/VChip.js +1 -0
  8. package/es5/components/VChip/VChip.js.map +1 -1
  9. package/es5/components/VList/VListItem.js +4 -2
  10. package/es5/components/VList/VListItem.js.map +1 -1
  11. package/es5/components/VMenu/VMenu.js +1 -1
  12. package/es5/components/VMenu/VMenu.js.map +1 -1
  13. package/es5/components/VOtpInput/VOtpInput.js +36 -0
  14. package/es5/components/VOtpInput/VOtpInput.js.map +1 -1
  15. package/es5/components/VSelect/VSelectList.js +15 -2
  16. package/es5/components/VSelect/VSelectList.js.map +1 -1
  17. package/es5/components/VTooltip/VTooltip.js +3 -3
  18. package/es5/components/VTooltip/VTooltip.js.map +1 -1
  19. package/es5/components/VTreeview/VTreeview.js +0 -7
  20. package/es5/components/VTreeview/VTreeview.js.map +1 -1
  21. package/es5/framework.js +1 -1
  22. package/es5/mixins/routable/index.js +5 -2
  23. package/es5/mixins/routable/index.js.map +1 -1
  24. package/lib/components/VAlert/VAlert.js +0 -1
  25. package/lib/components/VAlert/VAlert.js.map +1 -1
  26. package/lib/components/VChip/VChip.js +1 -0
  27. package/lib/components/VChip/VChip.js.map +1 -1
  28. package/lib/components/VList/VListItem.js +4 -2
  29. package/lib/components/VList/VListItem.js.map +1 -1
  30. package/lib/components/VMenu/VMenu.js +1 -1
  31. package/lib/components/VMenu/VMenu.js.map +1 -1
  32. package/lib/components/VOtpInput/VOtpInput.js +48 -0
  33. package/lib/components/VOtpInput/VOtpInput.js.map +1 -1
  34. package/lib/components/VSelect/VSelectList.js +11 -5
  35. package/lib/components/VSelect/VSelectList.js.map +1 -1
  36. package/lib/components/VTooltip/VTooltip.js +3 -3
  37. package/lib/components/VTooltip/VTooltip.js.map +1 -1
  38. package/lib/components/VTreeview/VTreeview.js +0 -6
  39. package/lib/components/VTreeview/VTreeview.js.map +1 -1
  40. package/lib/framework.js +1 -1
  41. package/lib/mixins/routable/index.js +5 -2
  42. package/lib/mixins/routable/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/components/VAlert/VAlert.ts +0 -1
  45. package/src/components/VApp/__tests__/VApp.spec.ts +24 -18
  46. package/src/components/VApp/__tests__/__snapshots__/VApp.spec.ts.snap +4 -4
  47. package/src/components/VAppBar/__tests__/VAppBar.spec.ts +256 -74
  48. package/src/components/VAppBar/__tests__/VAppBarNavIcon.spec.ts +2 -6
  49. package/src/components/VAppBar/__tests__/__snapshots__/VAppBar.spec.ts.snap +13 -4
  50. package/src/components/VAppBar/__tests__/__snapshots__/VAppBarNavIcon.spec.ts.snap +3 -4
  51. package/src/components/VBanner/__tests__/VBanner.spec.ts +35 -36
  52. package/src/components/VBanner/__tests__/__snapshots__/VBanner.spec.ts.snap +1 -1
  53. package/src/components/VBtn/__tests__/VBtn.spec.ts +1 -1
  54. package/src/components/VCard/__tests__/VCard.spec.ts +46 -28
  55. package/src/components/VCard/__tests__/__snapshots__/VCard.spec.ts.snap +2 -2
  56. package/src/components/VCheckbox/__tests__/VCheckbox.spec.ts +157 -152
  57. package/src/components/VChip/VChip.ts +1 -0
  58. package/src/components/VChip/__tests__/VChip.spec.ts +50 -50
  59. package/src/components/VChip/__tests__/__snapshots__/VChip.spec.ts.snap +4 -4
  60. package/src/components/VChipGroup/__tests__/VChipGroup.spec.ts +14 -21
  61. package/src/components/VColorPicker/__tests__/__snapshots__/VColorPicker.spec.ts.snap +35 -35
  62. package/src/components/VColorPicker/__tests__/__snapshots__/VColorPickerEdit.spec.ts.snap +10 -10
  63. package/src/components/VData/__tests__/VData.spec.ts +69 -90
  64. package/src/components/VDataTable/__tests__/MobileRow.spec.ts +55 -66
  65. package/src/components/VDataTable/__tests__/Row.spec.ts +64 -73
  66. package/src/components/VDataTable/__tests__/RowGroup.spec.ts +7 -5
  67. package/src/components/VDataTable/__tests__/VDataTable.spec.ts +910 -988
  68. package/src/components/VDataTable/__tests__/VEditDialog.spec.ts +26 -22
  69. package/src/components/VDataTable/__tests__/VSimpleTable.spec.ts +60 -29
  70. package/src/components/VDataTable/__tests__/VVirtualTable.spec.ts +13 -15
  71. package/src/components/VDataTable/__tests__/__snapshots__/Row.spec.ts.snap +30 -0
  72. package/src/components/VDataTable/__tests__/__snapshots__/VEditDialog.spec.ts.snap +18 -10
  73. package/src/components/VDataTable/mixins/__tests__/__snapshots__/header.spec.ts.snap +1 -1
  74. package/src/components/VDivider/__tests__/VDivider.spec.ts +11 -15
  75. package/src/components/VDivider/__tests__/__snapshots__/VDivider.spec.ts.snap +2 -2
  76. package/src/components/VGrid/__tests__/VCol.spec.ts +17 -17
  77. package/src/components/VGrid/__tests__/VContainer.spec.ts +58 -3
  78. package/src/components/VGrid/__tests__/VFlex.spec.ts +3 -3
  79. package/src/components/VGrid/__tests__/VGrid.spec.ts +12 -10
  80. package/src/components/VGrid/__tests__/VLayout.spec.ts +3 -3
  81. package/src/components/VIcon/__tests__/VIcon.spec.ts +176 -70
  82. package/src/components/VImg/__tests__/__snapshots__/VImg.spec.ts.snap +55 -55
  83. package/src/components/VItemGroup/__tests__/VItem.spec.ts +22 -37
  84. package/src/components/VItemGroup/__tests__/VItemGroup.spec.ts +96 -124
  85. package/src/components/VItemGroup/__tests__/__snapshots__/VItem.spec.ts.snap +2 -0
  86. package/src/components/VLabel/__tests__/VLabel.spec.ts +240 -14
  87. package/src/components/VLazy/__tests__/VLazy.spec.ts +5 -4
  88. package/src/components/VLazy/__tests__/__snapshots__/VLazy.spec.ts.snap +2 -1
  89. package/src/components/VList/VListItem.ts +9 -3
  90. package/src/components/VList/__tests__/VList.spec.ts +13 -12
  91. package/src/components/VList/__tests__/VListGroup.spec.ts +59 -51
  92. package/src/components/VList/__tests__/VListItem.spec.ts +142 -63
  93. package/src/components/VList/__tests__/VListItemAvatar.spec.ts +5 -2
  94. package/src/components/VList/__tests__/VListItemGroup.spec.ts +5 -2
  95. package/src/components/VList/__tests__/__snapshots__/VList.spec.ts.snap +10 -10
  96. package/src/components/VList/__tests__/__snapshots__/VListGroup.spec.ts.snap +5 -6
  97. package/src/components/VList/__tests__/__snapshots__/VListItem.spec.ts.snap +1 -1
  98. package/src/components/VMain/__tests__/VMain.spec.ts +71 -17
  99. package/src/components/VMenu/VMenu.ts +1 -1
  100. package/src/components/VMessages/__tests__/VMessages.spec.ts +14 -13
  101. package/src/components/VOtpInput/VOtpInput.ts +37 -1
  102. package/src/components/VParallax/__tests__/__snapshots__/VParallax.spec.ts.snap +8 -8
  103. package/src/components/VPicker/__tests__/__snapshots__/VPicker.spec.ts.snap +2 -2
  104. package/src/components/VResponsive/__tests__/__snapshots__/VResponsive.spec.ts.snap +2 -2
  105. package/src/components/VSelect/VSelectList.ts +9 -9
  106. package/src/components/VSelect/__tests__/VSelect.spec.ts +166 -125
  107. package/src/components/VSelect/__tests__/VSelect2.spec.ts +127 -111
  108. package/src/components/VSelect/__tests__/VSelect3.spec.ts +109 -91
  109. package/src/components/VSelect/__tests__/VSelect4.spec.ts +79 -68
  110. package/src/components/VSelect/__tests__/VSelectList.spec.ts +23 -31
  111. package/src/components/VSelect/__tests__/__snapshots__/VSelect.spec.ts.snap +58 -62
  112. package/src/components/VSelect/__tests__/__snapshots__/VSelect2.spec.ts.snap +50 -62
  113. package/src/components/VSelect/__tests__/__snapshots__/VSelect3.spec.ts.snap +10 -14
  114. package/src/components/VSparkline/__tests__/VSparkline.spec.ts +33 -35
  115. package/src/components/VStepper/__tests__/VStepper.spec.ts +4 -1
  116. package/src/components/VStepper/__tests__/VStepperContent.spec.ts +104 -110
  117. package/src/components/VStepper/__tests__/VStepperStep.spec.ts +51 -44
  118. package/src/components/VSwitch/__tests__/VSwitch.spec.ts +30 -37
  119. package/src/components/VTabs/__tests__/VTabs.spec.ts +0 -7
  120. package/src/components/VTextField/__tests__/VTextField.spec.ts +342 -246
  121. package/src/components/VTextarea/__tests__/VTextarea.spec.ts +112 -35
  122. package/src/components/VTimePicker/__tests__/__snapshots__/VTimePicker.spec.ts.snap +0 -40
  123. package/src/components/VToolbar/__tests__/VToolbar.spec.ts +49 -25
  124. package/src/components/VTooltip/VTooltip.ts +3 -3
  125. package/src/components/VTooltip/__tests__/__snapshots__/VTooltip.spec.ts.snap +34 -18
  126. package/src/components/VTreeview/VTreeview.ts +0 -5
  127. package/src/mixins/routable/index.ts +6 -4
@@ -1,3 +1,6 @@
1
+ // Libraries
2
+ import { defineComponent, h } from 'vue'
3
+
1
4
  // Components
2
5
  import VSelect from '../VSelect'
3
6
 
@@ -5,92 +8,100 @@ import VSelect from '../VSelect'
5
8
  import { keyCodes } from '../../../util/helpers'
6
9
  import {
7
10
  mount,
8
- Wrapper,
11
+ VueWrapper,
12
+ enableAutoUnmount,
9
13
  } from '@vue/test-utils'
10
14
  import { waitAnimationFrame } from '../../../../test'
11
15
 
16
+ const createMountFunction = () => (options = {}) => mount(VSelect, {
17
+ global: {
18
+ mocks: {
19
+ $vuetify: {
20
+ lang: { t: (val: string) => val },
21
+ theme: { dark: false },
22
+ icons: { component: 'mdi' },
23
+ },
24
+ },
25
+ },
26
+ ...options,
27
+ })
28
+
29
+ // eslint-disable-next-line max-statements
12
30
  describe('VSelect.ts', () => {
13
31
  type Instance = InstanceType<typeof VSelect>
14
- let mountFunction: (options?: object) => Wrapper<Instance>
32
+ let mountFunction: (options?: object) => VueWrapper<Instance>
15
33
  let el
16
34
 
17
35
  beforeEach(() => {
18
36
  el = document.createElement('div')
19
37
  el.setAttribute('data-app', 'true')
20
38
  document.body.appendChild(el)
21
- mountFunction = (options = {}) => {
22
- return mount(VSelect, {
23
- // https://github.com/vuejs/vue-test-utils/issues/1130
24
- sync: false,
25
- mocks: {
26
- $vuetify: {
27
- lang: {
28
- t: (val: string) => val,
29
- },
30
- theme: {
31
- dark: false,
32
- },
33
- },
34
- },
35
- ...options,
36
- })
37
- }
39
+ mountFunction = createMountFunction()
38
40
  })
39
41
 
40
42
  afterEach(() => {
41
43
  document.body.removeChild(el)
42
44
  })
43
45
 
44
- it('should use slotted prepend-item', () => {
46
+ enableAutoUnmount(afterEach)
47
+
48
+ it('should use slotted prepend-item', async () => {
45
49
  const wrapper = mountFunction({
46
- propsData: {
50
+ props: {
47
51
  eager: true,
52
+ attach: false,
48
53
  items: ['foo'],
49
54
  },
50
55
  slots: {
51
- 'prepend-item': [{
52
- render: h => h('div', 'foo'),
53
- }],
56
+ 'prepend-item': () => h('div', 'foo'),
54
57
  },
55
58
  })
56
59
 
57
- const list = wrapper.find('.v-list')
60
+ // Активируем меню через клик на слот
61
+ const slot = wrapper.find('.v-input__slot')
62
+ slot.trigger('click')
63
+ await wrapper.vm.$nextTick()
64
+
65
+ // Список рендерится в document.body через Teleport/Portal
66
+ const bodyList = document.querySelector('.v-list')
58
67
 
59
68
  expect(wrapper.vm.$slots['prepend-item']).toBeTruthy()
60
- expect(list.html()).toMatchSnapshot()
69
+ expect(bodyList).toBeTruthy()
70
+ expect(bodyList.outerHTML).toMatchSnapshot()
61
71
  })
62
72
 
63
- it('should use slotted append-item', () => {
73
+ it('should use slotted append-item', async () => {
64
74
  const wrapper = mountFunction({
65
- propsData: {
75
+ props: {
66
76
  eager: true,
67
77
  items: ['foo'],
68
78
  },
69
79
  slots: {
70
- 'append-item': [{
71
- render: h => h('div', 'foo'),
72
- }],
80
+ 'append-item': () => h('div', 'foo'),
73
81
  },
74
82
  })
75
83
 
76
- const list = wrapper.find('.v-list')
84
+ // Активируем меню через клик на слот
85
+ const slot = wrapper.find('.v-input__slot')
86
+ slot.trigger('click')
87
+ await wrapper.vm.$nextTick()
88
+
89
+ const bodyList = document.querySelector('.v-list')
77
90
 
78
91
  expect(wrapper.vm.$slots['append-item']).toBeTruthy()
79
- expect(list.html()).toMatchSnapshot()
92
+ expect(bodyList).toBeTruthy()
93
+ expect(bodyList.outerHTML).toMatchSnapshot()
80
94
  })
81
95
 
82
96
  it('should use scoped slot for selection generation', () => {
83
97
  const wrapper = mountFunction({
84
- render (h) {
98
+ render () {
85
99
  return h(VSelect, {
86
- attrs: {
87
- items: ['foo', 'bar'],
88
- value: 'foo',
89
- },
90
- scopedSlots: {
91
- selection: ({ item }) => {
92
- return h('div', item + ' - from slot')
93
- },
100
+ items: ['foo', 'bar'],
101
+ modelValue: 'foo',
102
+ }, {
103
+ selection: ({ item }) => {
104
+ return h('div', item + ' - from slot')
94
105
  },
95
106
  })
96
107
  },
@@ -101,7 +112,7 @@ describe('VSelect.ts', () => {
101
112
 
102
113
  it('should toggle menu on icon click', async () => {
103
114
  const wrapper = mountFunction({
104
- propsData: {
115
+ props: {
105
116
  items: ['foo', 'bar'],
106
117
  'menu-props': {
107
118
  offsetY: true,
@@ -136,9 +147,9 @@ describe('VSelect.ts', () => {
136
147
  // https://github.com/vuejs/vue-test-utils/issues/1130
137
148
  it.skip('should calculate the counter value', async () => {
138
149
  const wrapper = mountFunction({
139
- propsData: {
150
+ props: {
140
151
  items: ['foo'],
141
- value: 'foo',
152
+ modelValue: 'foo',
142
153
  },
143
154
  })
144
155
 
@@ -156,7 +167,7 @@ describe('VSelect.ts', () => {
156
167
  wrapper.setProps({
157
168
  items: ['foo', 'bar', 'baz'],
158
169
  multiple: true,
159
- value: ['foo', 'bar'],
170
+ modelValue: ['foo', 'bar'],
160
171
  })
161
172
  await wrapper.vm.$nextTick()
162
173
  expect(wrapper.vm.computedCounterValue).toBe(2)
@@ -164,25 +175,25 @@ describe('VSelect.ts', () => {
164
175
 
165
176
  it('should return the correct counter value', async () => {
166
177
  const wrapper = mountFunction({
167
- propsData: {
178
+ props: {
168
179
  items: ['foo', 'bar'],
169
- value: 'foo',
180
+ modelValue: 'foo',
170
181
  },
171
182
  })
172
183
 
173
184
  expect(wrapper.vm.computedCounterValue).toBe(3)
174
185
 
175
- wrapper.setProps({
186
+ await wrapper.setProps({
176
187
  multiple: true,
177
- value: ['foo'],
188
+ modelValue: ['foo'],
178
189
  })
179
190
 
180
191
  expect(wrapper.vm.computedCounterValue).toBe(1)
181
192
 
182
- wrapper.setProps({
193
+ await wrapper.setProps({
183
194
  counterValue: (value?: string): number => 2,
184
195
  multiple: false,
185
- value: undefined,
196
+ modelValue: undefined,
186
197
  })
187
198
 
188
199
  expect(wrapper.vm.computedCounterValue).toBe(2)
@@ -190,16 +201,13 @@ describe('VSelect.ts', () => {
190
201
 
191
202
  it('should emit a single change event', async () => {
192
203
  const wrapper = mountFunction({
193
- attachToDocument: true,
194
- propsData: {
204
+ attachTo: el,
205
+ props: {
195
206
  attach: true,
196
207
  items: ['foo', 'bar'],
197
208
  },
198
209
  })
199
210
 
200
- const change = jest.fn()
201
- wrapper.vm.$on('change', change)
202
-
203
211
  const menu = wrapper.find('.v-input__slot')
204
212
 
205
213
  menu.trigger('click')
@@ -211,26 +219,26 @@ describe('VSelect.ts', () => {
211
219
  wrapper.vm.blur()
212
220
  await wrapper.vm.$nextTick()
213
221
 
214
- expect(change.mock.calls).toEqual([['foo']])
222
+ const emitted = wrapper.emitted('change')
223
+ expect(emitted).toBeTruthy()
224
+ expect(emitted[0]).toEqual(['foo'])
215
225
  })
216
226
 
217
227
  it('should not emit change event when clicked on the selected item', async () => {
218
228
  const wrapper = mountFunction({
219
- propsData: {
229
+ props: {
220
230
  items: ['foo', 'bar'],
221
231
  },
222
232
  })
223
233
 
224
- const change = jest.fn()
225
- wrapper.vm.$on('change', change)
226
-
227
234
  wrapper.vm.selectItem('foo')
228
235
  await wrapper.vm.$nextTick()
229
236
 
230
237
  wrapper.vm.selectItem('foo')
231
238
  await wrapper.vm.$nextTick()
232
239
 
233
- expect(change.mock.calls).toHaveLength(1)
240
+ const emitted = wrapper.emitted('change')
241
+ expect(emitted).toHaveLength(1)
234
242
  })
235
243
 
236
244
  // https://github.com/vuetifyjs/vuetify/issues/13658
@@ -239,27 +247,29 @@ describe('VSelect.ts', () => {
239
247
  const itemA = { text: 'A', value: { foo: null } }
240
248
  const itemB = { text: 'B', value: { foo: '' } }
241
249
  const wrapper = mountFunction({
242
- propsData: {
250
+ props: {
243
251
  items: [itemA, itemB],
244
- value: { foo: null },
252
+ modelValue: { foo: null },
245
253
  },
246
254
  })
247
- wrapper.vm.$on('input', onInput)
255
+ // События теперь тестируются через emitted
248
256
 
249
257
  wrapper.vm.selectItem(itemA)
250
258
  await wrapper.vm.$nextTick()
251
- expect(onInput).toHaveBeenCalledTimes(0)
259
+ let emitted = wrapper.emitted('update:modelValue')
260
+ expect(emitted).toBeFalsy()
252
261
 
253
262
  wrapper.vm.selectItem(itemB)
254
263
  await wrapper.vm.$nextTick()
255
- expect(onInput).toHaveBeenCalledTimes(1)
264
+ emitted = wrapper.emitted('update:modelValue')
265
+ expect(emitted).toHaveLength(1)
256
266
  })
257
267
 
258
268
  // Inspired by https://github.com/vuetifyjs/vuetify/pull/1425 - Thanks @kevmo314
259
269
  it('should open the select when focused and enter, space are pressed', async () => {
260
270
  const wrapper = mountFunction({
261
- attachToDocument: true,
262
- propsData: {
271
+ attachTo: el,
272
+ props: {
263
273
  items: ['foo', 'bar'],
264
274
  },
265
275
  })
@@ -280,8 +290,8 @@ describe('VSelect.ts', () => {
280
290
 
281
291
  it('should not open the select when readonly and focused and enter, space, up or down are pressed', async () => {
282
292
  const wrapper = mountFunction({
283
- attachToDocument: true,
284
- propsData: {
293
+ attachTo: el,
294
+ props: {
285
295
  items: ['foo', 'bar'],
286
296
  readonly: true,
287
297
  menuProps: 'eager',
@@ -303,19 +313,16 @@ describe('VSelect.ts', () => {
303
313
 
304
314
  it('should clear input value', async () => {
305
315
  const wrapper = mountFunction({
306
- attachToDocument: true,
307
- propsData: {
316
+ attachTo: el,
317
+ props: {
308
318
  clearable: true,
309
319
  items: ['foo', 'bar'],
310
- value: 'foo',
320
+ modelValue: 'foo',
311
321
  },
312
322
  })
313
323
 
314
324
  const clear = wrapper.find('.v-icon')
315
325
 
316
- const input = jest.fn()
317
- wrapper.vm.$on('input', input)
318
-
319
326
  await wrapper.vm.$nextTick()
320
327
  expect(wrapper.vm.internalValue).toBe('foo')
321
328
  clear.trigger('click')
@@ -323,16 +330,18 @@ describe('VSelect.ts', () => {
323
330
  await wrapper.vm.$nextTick()
324
331
 
325
332
  expect(wrapper.vm.internalValue).toBeNull()
326
- expect(input).toHaveBeenCalledWith(null)
333
+ const emitted = wrapper.emitted('update:modelValue')
334
+ expect(emitted).toBeTruthy()
335
+ expect(emitted[0]).toEqual([null])
327
336
  })
328
337
 
329
338
  it('should be clearable with prop, dirty and single select', async () => {
330
339
  const wrapper = mountFunction({
331
- attachToDocument: true,
332
- propsData: {
340
+ attachTo: el,
341
+ props: {
333
342
  clearable: true,
334
343
  items: [1, 2],
335
- value: 1,
344
+ modelValue: 1,
336
345
  },
337
346
  })
338
347
 
@@ -350,26 +359,26 @@ describe('VSelect.ts', () => {
350
359
 
351
360
  it('should be clearable with prop, dirty and multi select', async () => {
352
361
  const wrapper = mountFunction({
353
- attachToDocument: true,
354
- propsData: {
362
+ attachTo: el,
363
+ props: {
355
364
  clearable: true,
356
365
  items: [1, 2],
357
366
  multiple: true,
358
- value: [1],
367
+ modelValue: [1],
359
368
  },
360
369
  })
361
370
 
362
371
  const clear = wrapper.find('.v-icon')
363
372
 
364
- const change = jest.fn()
365
- wrapper.vm.$on('change', change)
366
-
367
373
  await wrapper.vm.$nextTick()
368
374
  expect(wrapper.html()).toMatchSnapshot()
369
375
 
370
376
  clear.trigger('click')
371
377
  await wrapper.vm.$nextTick()
372
- expect(change).toHaveBeenCalledWith([])
378
+
379
+ const emitted = wrapper.emitted('change')
380
+ expect(emitted).toBeTruthy()
381
+ expect(emitted[0]).toEqual([[]])
373
382
  expect(wrapper.vm.isMenuActive).toBe(false)
374
383
  })
375
384
 
@@ -377,24 +386,24 @@ describe('VSelect.ts', () => {
377
386
  const items = ['foo', 'bar', 'baz']
378
387
 
379
388
  const wrapper = mountFunction({
380
- propsData: {
389
+ props: {
381
390
  items,
382
- value: 'foo',
391
+ modelValue: 'foo',
383
392
  },
384
393
  })
385
394
 
386
395
  const wrapper2 = mountFunction({
387
- propsData: {
396
+ props: {
388
397
  items,
389
398
  multiple: true,
390
- value: ['foo', 'bar'],
399
+ modelValue: ['foo', 'bar'],
391
400
  },
392
401
  })
393
402
 
394
403
  const wrapper3 = mountFunction({
395
- propsData: {
404
+ props: {
396
405
  items,
397
- value: null,
406
+ modelValue: null,
398
407
  },
399
408
  })
400
409
 
@@ -406,14 +415,14 @@ describe('VSelect.ts', () => {
406
415
  // #1704
407
416
  it('should populate select when using value as an object', async () => {
408
417
  const wrapper = mountFunction({
409
- attachToDocument: true,
410
- propsData: {
418
+ attachTo: el,
419
+ props: {
411
420
  items: [
412
421
  { text: 'foo', value: { id: 1 } },
413
422
  { text: 'foo', value: { id: 2 } },
414
423
  ],
415
424
  multiple: true,
416
- value: [{ id: 1 }],
425
+ modelValue: [{ id: 1 }],
417
426
  },
418
427
  })
419
428
 
@@ -427,33 +436,42 @@ describe('VSelect.ts', () => {
427
436
  // Discovered when working on #1704
428
437
  it('should remove item when re-selecting it', async () => {
429
438
  const wrapper = mountFunction({
430
- attachToDocument: true,
431
- propsData: {
439
+ attachTo: el,
440
+ props: {
432
441
  eager: true,
433
442
  items: [
434
443
  { text: 'bar', value: { id: 1 } },
435
444
  { text: 'foo', value: { id: 2 } },
436
445
  ],
437
446
  multiple: true,
438
- value: [{ id: 1 }],
447
+ modelValue: [{ id: 1 }],
439
448
  },
440
449
  })
441
450
 
442
451
  expect(wrapper.vm.selectedItems).toHaveLength(1)
443
- wrapper.trigger('click')
444
- const item = wrapper.find('div.v-list-item__action')
445
- item.trigger('click')
452
+
453
+ // Активируем меню через клик на слот
454
+ const slot = wrapper.find('.v-input__slot')
455
+ slot.trigger('click')
456
+ await wrapper.vm.$nextTick()
457
+
458
+ // Элементы рендерятся в document.body через Teleport/Portal
459
+ // Для multiple select кликаем на первый элемент списка (который уже выбран)
460
+ const listItem = document.querySelector('.v-list-item')
461
+ expect(listItem).toBeTruthy()
462
+
463
+ listItem.click()
446
464
  await wrapper.vm.$nextTick()
447
465
  expect(wrapper.vm.selectedItems).toHaveLength(0)
448
466
  })
449
467
 
450
468
  it('should open menu when cleared with open-on-clear', async () => {
451
469
  const wrapper = mountFunction({
452
- propsData: {
470
+ props: {
453
471
  clearable: true,
454
472
  openOnClear: true,
455
473
  items: [1],
456
- value: 1,
474
+ modelValue: 1,
457
475
  },
458
476
  })
459
477
 
@@ -469,13 +487,10 @@ describe('VSelect.ts', () => {
469
487
  /* eslint-disable-next-line max-statements */
470
488
  it('should react to different key down', async () => {
471
489
  const wrapper = mountFunction({
472
- propsData: {
490
+ props: {
473
491
  items: [1, 2, 3, 4],
474
492
  },
475
493
  })
476
- const blur = jest.fn()
477
- wrapper.vm.$on('blur', blur)
478
-
479
494
  const event = new Event('keydown')
480
495
  event.keyCode = keyCodes.tab
481
496
 
@@ -484,7 +499,8 @@ describe('VSelect.ts', () => {
484
499
 
485
500
  await waitAnimationFrame()
486
501
 
487
- expect(blur).toHaveBeenCalled()
502
+ const emitted = wrapper.emitted('blur')
503
+ expect(emitted).toBeTruthy()
488
504
  expect(wrapper.vm.isMenuActive).toBe(false)
489
505
 
490
506
  // Enter and Space