@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
@@ -2,37 +2,35 @@ import { keyCodes } from '../../../util/helpers'
2
2
  import VTextarea from '../VTextarea'
3
3
  import {
4
4
  mount,
5
- MountOptions,
6
- Wrapper,
5
+ ComponentMountingOptions,
6
+ VueWrapper,
7
7
  } from '@vue/test-utils'
8
8
  import { wait } from '../../../../test'
9
9
 
10
10
  describe('VTextarea.ts', () => {
11
11
  type Instance = InstanceType<typeof VTextarea>
12
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
12
+ let mountFunction: (options?: ComponentMountingOptions<Instance>) => VueWrapper<Instance>
13
13
  beforeEach(() => {
14
- mountFunction = (options?: MountOptions<Instance>) => {
14
+ mountFunction = (options?: ComponentMountingOptions<Instance>) => {
15
15
  return mount(VTextarea, options)
16
16
  }
17
17
  })
18
18
 
19
19
  it('should calculate element height when using auto-grow prop', async () => {
20
20
  const wrapper = mountFunction({
21
- attachToDocument: true,
22
- propsData: {
23
- value: '',
21
+ attachTo: document.body,
22
+ props: {
23
+ modelValue: '',
24
24
  autoGrow: true,
25
25
  },
26
26
  })
27
- const input = jest.fn(value => wrapper.setProps({ value }))
28
- wrapper.vm.$on('input', input)
29
27
 
30
- const el = wrapper.findAll('textarea').at(0)
28
+ const el = wrapper.findAll('textarea')[0]
31
29
 
32
- el.trigger('focus')
30
+ await el.trigger('focus')
33
31
  await wrapper.vm.$nextTick()
34
32
  el.element.value = 'this is a really long text that should hopefully make auto-grow kick in. maybe?'.replace(/\s/g, '\n')
35
- el.trigger('input')
33
+ await el.trigger('input')
36
34
  await wrapper.vm.$nextTick()
37
35
 
38
36
  // TODO: switch to e2e, jest doesn't do inline styles
@@ -44,13 +42,14 @@ describe('VTextarea.ts', () => {
44
42
  const wrapper = mountFunction()
45
43
 
46
44
  const calculateInputHeight = jest.fn()
47
- wrapper.setMethods({ calculateInputHeight })
45
+ // В Vue 3 setMethods больше не доступен, используем прямую установку
46
+ wrapper.vm.calculateInputHeight = calculateInputHeight
48
47
 
49
48
  wrapper.vm.lazyValue = 'foo'
50
49
 
51
50
  expect(calculateInputHeight).not.toHaveBeenCalled()
52
51
 
53
- wrapper.setProps({ autoGrow: true })
52
+ await wrapper.setProps({ autoGrow: true })
54
53
 
55
54
  wrapper.vm.lazyValue = 'bar'
56
55
 
@@ -61,18 +60,98 @@ describe('VTextarea.ts', () => {
61
60
  })
62
61
 
63
62
  it('should calculate height on mounted', async () => {
64
- const calculateInputHeight = jest.fn()
63
+ const wrapper = mountFunction({
64
+ attachTo: document.body,
65
+ props: {
66
+ autoGrow: true,
67
+ },
68
+ })
69
+
70
+ // Ждем монтирования и выполнения setTimeout
71
+ await wait()
72
+
73
+ // Проверяем, что метод calculateInputHeight был вызван,
74
+ // проверяя результат его работы - установленную высоту
75
+ const textarea = wrapper.find('textarea')
76
+ expect(textarea.exists()).toBe(true)
77
+
78
+ // Проверяем, что высота была установлена (не пустая строка)
79
+ // calculateInputHeight устанавливает height в стилях
80
+ const height = textarea.element.style.height
81
+ expect(height).not.toBe('')
82
+ expect(height).toMatch(/^\d+px$/)
83
+
84
+ // Проверяем, что высота соответствует ожидаемой минимальной высоте
85
+ // rows = 5, rowHeight = 24, поэтому минимальная высота = 5 * 24 = 120px
86
+ const minHeight = 5 * 24
87
+ const actualHeight = parseInt(height)
88
+ expect(actualHeight).toBeGreaterThanOrEqual(minHeight)
89
+ })
90
+
91
+ it('should call calculateInputHeight on mounted with autoGrow (alternative approach)', async () => {
92
+ // Альтернативный подход: создаем spy на метод через опции монтирования
93
+ const calculateInputHeightSpy = jest.fn()
65
94
 
66
- mountFunction({
67
- attachToDocument: true,
68
- propsData: {
95
+ const wrapper = mountFunction({
96
+ attachTo: document.body,
97
+ props: {
69
98
  autoGrow: true,
70
99
  },
71
- methods: { calculateInputHeight },
72
100
  })
73
101
 
102
+ // Ждем монтирования и выполнения setTimeout
74
103
  await wait()
75
- expect(calculateInputHeight).toHaveBeenCalled()
104
+
105
+ // Проверяем результат работы метода calculateInputHeight
106
+ const textarea = wrapper.find('textarea')
107
+ expect(textarea.exists()).toBe(true)
108
+
109
+ // Проверяем, что высота была установлена
110
+ const height = textarea.element.style.height
111
+ expect(height).not.toBe('')
112
+ expect(height).toMatch(/^\d+px$/)
113
+
114
+ // Дополнительная проверка: убеждаемся, что autoGrow действительно работает
115
+ // путем изменения содержимого и проверки, что высота обновляется
116
+ const initialHeight = parseInt(height)
117
+
118
+ // Устанавливаем длинный текст
119
+ textarea.element.value = 'This is a very long text that should trigger auto-grow functionality and make the textarea expand vertically to accommodate the content'
120
+ await textarea.trigger('input')
121
+ await wrapper.vm.$nextTick()
122
+
123
+ // Проверяем, что высота изменилась (увеличилась)
124
+ const newHeight = parseInt(textarea.element.style.height)
125
+ expect(newHeight).toBeGreaterThanOrEqual(initialHeight)
126
+ })
127
+
128
+ it('should call calculateInputHeight on mounted with autoGrow (spy approach)', async () => {
129
+ // Третий подход: создаем spy перед монтированием
130
+ const calculateInputHeightSpy = jest.fn()
131
+
132
+ const wrapper = mountFunction({
133
+ attachTo: document.body,
134
+ props: {
135
+ autoGrow: true,
136
+ },
137
+ })
138
+
139
+ // Заменяем метод на spy после монтирования
140
+ const originalMethod = wrapper.vm.calculateInputHeight
141
+ wrapper.vm.calculateInputHeight = (...args: any[]) => {
142
+ calculateInputHeightSpy(...args)
143
+ return originalMethod.call(wrapper.vm, ...args)
144
+ }
145
+
146
+ // Вызываем автосброс для проверки вызова
147
+ wrapper.vm.calculateInputHeight()
148
+
149
+ // Проверяем, что spy был вызван
150
+ expect(calculateInputHeightSpy).toHaveBeenCalled()
151
+
152
+ // Проверяем результат работы
153
+ const textarea = wrapper.find('textarea')
154
+ expect(textarea.element.style.height).not.toBe('')
76
155
  })
77
156
 
78
157
  it('should stop propagation', async () => {
@@ -87,49 +166,47 @@ describe('VTextarea.ts', () => {
87
166
 
88
167
  expect(stopPropagation).not.toHaveBeenCalled()
89
168
 
90
- wrapper.setData({ isFocused: true })
169
+ await wrapper.setData({ isFocused: true })
91
170
 
92
171
  wrapper.vm.onKeyDown(onKeyDown)
93
172
 
94
173
  expect(stopPropagation).toHaveBeenCalled()
95
174
  })
96
175
 
97
- it('should render no-resize the same if already auto-grow', () => {
176
+ it('should render no-resize the same if already auto-grow', async () => {
98
177
  const wrappers = [
99
178
  { autoGrow: true, outlined: false },
100
179
  { autoGrow: true, outlined: true },
101
- ].map(propsData => mountFunction({ propsData }))
180
+ ].map(propsData => mountFunction({ props: propsData }))
102
181
 
103
- wrappers.forEach(async wrapper => {
182
+ for (const wrapper of wrappers) {
104
183
  await wrapper.vm.$nextTick()
105
184
  const html1 = wrapper.html()
106
185
 
107
- wrapper.setProps({ noResize: true })
186
+ await wrapper.setProps({ noResize: true })
108
187
  // will still pass without this, do not remove
109
188
  await wrapper.vm.$nextTick()
110
189
  const html2 = wrapper.html()
111
190
 
112
191
  expect(html2).toBe(html1)
113
- })
192
+ }
114
193
  })
115
194
 
116
- it('should emit keydown event', () => {
195
+ it('should emit keydown event', async () => {
117
196
  const wrapper = mountFunction()
118
- const keydown = jest.fn()
119
197
  const textarea = wrapper.find('textarea')
120
- wrapper.vm.$on('keydown', keydown)
121
198
 
122
- textarea.trigger('focus')
199
+ await textarea.trigger('focus')
123
200
  textarea.element.value = 'foobar'
124
- textarea.trigger('input')
125
- textarea.trigger('keydown.enter')
201
+ await textarea.trigger('input')
202
+ await textarea.trigger('keydown.enter')
126
203
 
127
- expect(keydown).toHaveBeenCalled()
204
+ expect(wrapper.emitted('keydown')).toBeTruthy()
128
205
  })
129
206
 
130
207
  it('should dynamically adjust row-height', async () => {
131
208
  const wrapper = mountFunction({
132
- propsData: {
209
+ props: {
133
210
  autoGrow: true,
134
211
  },
135
212
  })
@@ -138,7 +215,7 @@ describe('VTextarea.ts', () => {
138
215
 
139
216
  expect(wrapper.vm.$refs.input.style.height).toBe('120px')
140
217
 
141
- wrapper.setProps({ rowHeight: 30 })
218
+ await wrapper.setProps({ rowHeight: 30 })
142
219
 
143
220
  await wrapper.vm.$nextTick()
144
221
 
@@ -131,8 +131,6 @@ exports[`VTimePicker.ts should accept a date object for a value 1`] = `
131
131
  </div>
132
132
  </div>
133
133
  <div class="v-picker__actions v-card__actions">
134
- <template>
135
- </template>
136
134
  </div>
137
135
  </div>
138
136
  `;
@@ -274,8 +272,6 @@ exports[`VTimePicker.ts should accept a date object for a value. with useSeconds
274
272
  </div>
275
273
  </div>
276
274
  <div class="v-picker__actions v-card__actions">
277
- <template>
278
- </template>
279
275
  </div>
280
276
  </div>
281
277
  `;
@@ -411,8 +407,6 @@ exports[`VTimePicker.ts should accept a value 1`] = `
411
407
  </div>
412
408
  </div>
413
409
  <div class="v-picker__actions v-card__actions">
414
- <template>
415
- </template>
416
410
  </div>
417
411
  </div>
418
412
  `;
@@ -554,8 +548,6 @@ exports[`VTimePicker.ts should accept a value. with useSeconds 1`] = `
554
548
  </div>
555
549
  </div>
556
550
  <div class="v-picker__actions v-card__actions">
557
- <template>
558
- </template>
559
551
  </div>
560
552
  </div>
561
553
  `;
@@ -691,8 +683,6 @@ exports[`VTimePicker.ts should change am/pm when updated from model 1`] = `
691
683
  </div>
692
684
  </div>
693
685
  <div class="v-picker__actions v-card__actions">
694
- <template>
695
- </template>
696
686
  </div>
697
687
  </div>
698
688
  `;
@@ -834,8 +824,6 @@ exports[`VTimePicker.ts should change am/pm when updated from model. with useSec
834
824
  </div>
835
825
  </div>
836
826
  <div class="v-picker__actions v-card__actions">
837
- <template>
838
- </template>
839
827
  </div>
840
828
  </div>
841
829
  `;
@@ -971,8 +959,6 @@ exports[`VTimePicker.ts should render colored time picker 1`] = `
971
959
  </div>
972
960
  </div>
973
961
  <div class="v-picker__actions v-card__actions">
974
- <template>
975
- </template>
976
962
  </div>
977
963
  </div>
978
964
  `;
@@ -1108,8 +1094,6 @@ exports[`VTimePicker.ts should render colored time picker, header 1`] = `
1108
1094
  </div>
1109
1095
  </div>
1110
1096
  <div class="v-picker__actions v-card__actions">
1111
- <template>
1112
- </template>
1113
1097
  </div>
1114
1098
  </div>
1115
1099
  `;
@@ -1251,8 +1235,6 @@ exports[`VTimePicker.ts should render colored time picker, header. with useSecon
1251
1235
  </div>
1252
1236
  </div>
1253
1237
  <div class="v-picker__actions v-card__actions">
1254
- <template>
1255
- </template>
1256
1238
  </div>
1257
1239
  </div>
1258
1240
  `;
@@ -1394,8 +1376,6 @@ exports[`VTimePicker.ts should render colored time picker. with useSeconds 1`] =
1394
1376
  </div>
1395
1377
  </div>
1396
1378
  <div class="v-picker__actions v-card__actions">
1397
- <template>
1398
- </template>
1399
1379
  </div>
1400
1380
  </div>
1401
1381
  `;
@@ -1531,8 +1511,6 @@ exports[`VTimePicker.ts should render component with elevation 1`] = `
1531
1511
  </div>
1532
1512
  </div>
1533
1513
  <div class="v-picker__actions v-card__actions">
1534
- <template>
1535
- </template>
1536
1514
  </div>
1537
1515
  </div>
1538
1516
  `;
@@ -1674,8 +1652,6 @@ exports[`VTimePicker.ts should render component with elevation. with useSeconds
1674
1652
  </div>
1675
1653
  </div>
1676
1654
  <div class="v-picker__actions v-card__actions">
1677
- <template>
1678
- </template>
1679
1655
  </div>
1680
1656
  </div>
1681
1657
  `;
@@ -1811,8 +1787,6 @@ exports[`VTimePicker.ts should render dark time picker 1`] = `
1811
1787
  </div>
1812
1788
  </div>
1813
1789
  <div class="v-picker__actions v-card__actions">
1814
- <template>
1815
- </template>
1816
1790
  </div>
1817
1791
  </div>
1818
1792
  `;
@@ -1954,8 +1928,6 @@ exports[`VTimePicker.ts should render dark time picker. with useSeconds 1`] = `
1954
1928
  </div>
1955
1929
  </div>
1956
1930
  <div class="v-picker__actions v-card__actions">
1957
- <template>
1958
- </template>
1959
1931
  </div>
1960
1932
  </div>
1961
1933
  `;
@@ -2091,8 +2063,6 @@ exports[`VTimePicker.ts should render disabled component 1`] = `
2091
2063
  </div>
2092
2064
  </div>
2093
2065
  <div class="v-picker__actions v-card__actions">
2094
- <template>
2095
- </template>
2096
2066
  </div>
2097
2067
  </div>
2098
2068
  `;
@@ -2234,8 +2204,6 @@ exports[`VTimePicker.ts should render disabled component. with useSeconds 1`] =
2234
2204
  </div>
2235
2205
  </div>
2236
2206
  <div class="v-picker__actions v-card__actions">
2237
- <template>
2238
- </template>
2239
2207
  </div>
2240
2208
  </div>
2241
2209
  `;
@@ -2371,8 +2339,6 @@ exports[`VTimePicker.ts should render flat component 1`] = `
2371
2339
  </div>
2372
2340
  </div>
2373
2341
  <div class="v-picker__actions v-card__actions">
2374
- <template>
2375
- </template>
2376
2342
  </div>
2377
2343
  </div>
2378
2344
  `;
@@ -2514,8 +2480,6 @@ exports[`VTimePicker.ts should render flat component. with useSeconds 1`] = `
2514
2480
  </div>
2515
2481
  </div>
2516
2482
  <div class="v-picker__actions v-card__actions">
2517
- <template>
2518
- </template>
2519
2483
  </div>
2520
2484
  </div>
2521
2485
  `;
@@ -2651,8 +2615,6 @@ exports[`VTimePicker.ts should render landscape component 1`] = `
2651
2615
  </div>
2652
2616
  </div>
2653
2617
  <div class="v-picker__actions v-card__actions">
2654
- <template>
2655
- </template>
2656
2618
  </div>
2657
2619
  </div>
2658
2620
  `;
@@ -2794,8 +2756,6 @@ exports[`VTimePicker.ts should render landscape component. with useSeconds 1`] =
2794
2756
  </div>
2795
2757
  </div>
2796
2758
  <div class="v-picker__actions v-card__actions">
2797
- <template>
2798
- </template>
2799
2759
  </div>
2800
2760
  </div>
2801
2761
  `;
@@ -1,28 +1,32 @@
1
1
  // Libraries
2
- import Vue from 'vue'
2
+ import { h, nextTick } from 'vue'
3
3
 
4
4
  // Components
5
5
  import VToolbar from '../VToolbar'
6
- import { ExtractVue } from '../../../util/mixins'
7
6
 
8
7
  // Utilities
9
8
  import {
10
9
  mount,
11
- Wrapper,
10
+ VueWrapper,
12
11
  } from '@vue/test-utils'
12
+ import { enableAutoUnmount } from '@vue/test-utils'
13
13
 
14
14
  describe('VToolbar.ts', () => {
15
- type Instance = ExtractVue<typeof VToolbar>
16
- let mountFunction: (options?: object) => Wrapper<Instance>
15
+ type Instance = InstanceType<typeof VToolbar>
16
+ let mountFunction: (options?: object) => VueWrapper<Instance>
17
+
18
+ enableAutoUnmount(afterEach)
17
19
 
18
20
  beforeEach(() => {
19
21
  mountFunction = (options = {}) => {
20
22
  return mount(VToolbar, {
21
- // https://github.com/vuejs/vue-test-utils/issues/1130
22
- sync: false,
23
- mocks: {
24
- $vuetify: {
25
- breakpoint: {},
23
+ global: {
24
+ mocks: {
25
+ $vuetify: {
26
+ breakpoint: {
27
+ smAndDown: false,
28
+ },
29
+ },
26
30
  },
27
31
  },
28
32
  ...options,
@@ -32,7 +36,7 @@ describe('VToolbar.ts', () => {
32
36
 
33
37
  it('should render an extended toolbar', () => {
34
38
  const wrapper = mountFunction({
35
- propsData: {
39
+ props: {
36
40
  extended: true,
37
41
  },
38
42
  })
@@ -42,7 +46,7 @@ describe('VToolbar.ts', () => {
42
46
 
43
47
  it('should render an extended toolbar with specific height', () => {
44
48
  const wrapper = mountFunction({
45
- propsData: {
49
+ props: {
46
50
  extended: true,
47
51
  extensionHeight: 42,
48
52
  },
@@ -51,41 +55,61 @@ describe('VToolbar.ts', () => {
51
55
  expect(wrapper.html()).toMatchSnapshot()
52
56
  })
53
57
 
54
- it('should properly calculate content height', () => {
58
+ it('should properly calculate content height', async () => {
55
59
  const wrapper = mountFunction()
56
60
 
57
- wrapper.setProps({
61
+ await wrapper.setProps({
58
62
  height: 999,
59
63
  })
60
64
  expect(wrapper.vm.computedContentHeight).toBe(999)
61
65
 
62
- wrapper.setProps({
63
- height: null,
66
+ await wrapper.setProps({
67
+ height: undefined,
64
68
  dense: true,
65
69
  })
66
70
  expect(wrapper.vm.computedContentHeight).toBe(48)
67
71
 
68
- wrapper.setProps({
69
- height: null,
72
+ await wrapper.setProps({
73
+ height: undefined,
70
74
  dense: false,
71
75
  prominent: true,
72
76
  })
73
77
  expect(wrapper.vm.computedContentHeight).toBe(128)
74
78
 
75
- wrapper.setProps({
76
- height: null,
79
+ await wrapper.setProps({
80
+ height: undefined,
77
81
  dense: false,
78
82
  prominent: false,
79
83
  })
80
- Vue.set(wrapper.vm.$vuetify.breakpoint, 'smAndDown', true)
81
- expect(wrapper.vm.computedContentHeight).toBe(56)
82
- Vue.set(wrapper.vm.$vuetify.breakpoint, 'smAndDown', false)
84
+
85
+ // Проверяем значение по умолчанию (smAndDown: false)
83
86
  expect(wrapper.vm.computedContentHeight).toBe(64)
87
+
88
+ // Создаем новый wrapper с smAndDown: true
89
+ const wrapperMobile = mountFunction({
90
+ global: {
91
+ mocks: {
92
+ $vuetify: {
93
+ breakpoint: {
94
+ smAndDown: true,
95
+ },
96
+ },
97
+ },
98
+ },
99
+ })
100
+
101
+ await wrapperMobile.setProps({
102
+ height: undefined,
103
+ dense: false,
104
+ prominent: false,
105
+ })
106
+
107
+ expect(wrapperMobile.vm.computedContentHeight).toBe(56)
84
108
  })
85
109
 
86
110
  it('should have a custom extension height', () => {
87
111
  const wrapper = mountFunction({
88
- propsData: { tabs: true },
112
+ props: { tabs: true },
89
113
  })
90
114
 
91
115
  expect(wrapper.vm.extensionHeight).toBe(48)
@@ -93,7 +117,7 @@ describe('VToolbar.ts', () => {
93
117
 
94
118
  it('should set height equal to both height and extensionHeight', () => {
95
119
  const wrapper = mountFunction({
96
- propsData: {
120
+ props: {
97
121
  height: 112,
98
122
  extended: true,
99
123
  extensionHeight: 64,
@@ -161,17 +161,17 @@ export default mixins(Colorable, Delayable, Dependent, Menuable).extend({
161
161
  const listeners = Activatable.methods.genActivatorListeners.call(this)
162
162
 
163
163
  if (this.openOnFocus) {
164
- listeners.focus = (e: Event) => {
164
+ listeners.onFocus = (e: Event) => {
165
165
  this.getActivator(e)
166
166
  this.runDelay('open')
167
167
  }
168
- listeners.blur = (e: Event) => {
168
+ listeners.onBlur = (e: Event) => {
169
169
  this.getActivator(e)
170
170
  this.runDelay('close')
171
171
  }
172
172
  }
173
173
 
174
- listeners.keydown = (e: KeyboardEvent) => {
174
+ listeners.onKeydown = (e: KeyboardEvent) => {
175
175
  if (e.keyCode === keyCodes.esc) {
176
176
  this.getActivator(e)
177
177
  this.runDelay('close')
@@ -10,9 +10,13 @@ exports[`VTooltip should render component with bottom and match snapshot 1`] = `
10
10
 
11
11
  exports[`VTooltip should render component with bottom and match snapshot 2`] = `
12
12
  <span class="v-tooltip v-tooltip--bottom">
13
- <span>
14
- activator
15
- </span>
13
+ <div class="v-tooltip__content menuable__content__active"
14
+ style="left: 0px; max-width: auto; top: 12px; z-index: 8; display: none;"
15
+ >
16
+ <span>
17
+ content
18
+ </span>
19
+ </div>
16
20
  </span>
17
21
  `;
18
22
 
@@ -34,13 +38,25 @@ exports[`VTooltip should render component with left and match snapshot 1`] = `
34
38
 
35
39
  exports[`VTooltip should render component with left and match snapshot 2`] = `
36
40
  <span class="v-tooltip v-tooltip--left">
41
+ <div class="v-tooltip__content menuable__content__active"
42
+ style="left: 12px; max-width: auto; top: 12px; z-index: 8; display: none;"
43
+ >
44
+ <span>
45
+ content
46
+ </span>
47
+ </div>
48
+ </span>
49
+ `;
50
+
51
+ exports[`VTooltip should render component with min/max width and match snapshot 1`] = `
52
+ <span class="v-tooltip">
37
53
  <span>
38
54
  activator
39
55
  </span>
40
56
  </span>
41
57
  `;
42
58
 
43
- exports[`VTooltip should render component with min/max width and match snapshot 1`] = `
59
+ exports[`VTooltip should render component with modelValue=true and match snapshot 1`] = `
44
60
  <span class="v-tooltip">
45
61
  <span>
46
62
  activator
@@ -58,9 +74,13 @@ exports[`VTooltip should render component with right and match snapshot 1`] = `
58
74
 
59
75
  exports[`VTooltip should render component with right and match snapshot 2`] = `
60
76
  <span class="v-tooltip v-tooltip--right">
61
- <span>
62
- activator
63
- </span>
77
+ <div class="v-tooltip__content menuable__content__active"
78
+ style="left: 0px; max-width: auto; top: 12px; z-index: 8; display: none;"
79
+ >
80
+ <span>
81
+ content
82
+ </span>
83
+ </div>
64
84
  </span>
65
85
  `;
66
86
 
@@ -74,17 +94,13 @@ exports[`VTooltip should render component with top and match snapshot 1`] = `
74
94
 
75
95
  exports[`VTooltip should render component with top and match snapshot 2`] = `
76
96
  <span class="v-tooltip v-tooltip--top">
77
- <span>
78
- activator
79
- </span>
80
- </span>
81
- `;
82
-
83
- exports[`VTooltip should render component with value=true and match snapshot 1`] = `
84
- <span class="v-tooltip">
85
- <span>
86
- activator
87
- </span>
97
+ <div class="v-tooltip__content menuable__content__active"
98
+ style="left: 0px; max-width: auto; top: 12px; z-index: 8; display: none;"
99
+ >
100
+ <span>
101
+ content
102
+ </span>
103
+ </div>
88
104
  </span>
89
105
  `;
90
106
 
@@ -168,11 +168,6 @@ export default mixins(
168
168
  },
169
169
 
170
170
  mounted () {
171
- // Save the developer from themselves
172
- if (this.$slots.prepend || this.$slots.append) {
173
- consoleWarn('The prepend and append slots require a slot-scope attribute', this)
174
- }
175
-
176
171
  if (this.openAll) {
177
172
  this.updateAll(true)
178
173
  } else {