@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
@@ -4,16 +4,26 @@ import VListItem from '../VListItem'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- Wrapper,
7
+ VueWrapper,
8
+ enableAutoUnmount,
8
9
  } from '@vue/test-utils'
10
+ import { Vue3RouterLinkStub } from '../../../../test/util/stubs'
9
11
 
10
12
  describe('VListItem.ts', () => {
11
13
  type Instance = InstanceType<typeof VListItem>
12
- let mountFunction: (options?: object) => Wrapper<Instance>
14
+ let mountFunction: (options?: any) => VueWrapper<Instance>
15
+
16
+ enableAutoUnmount(afterEach)
13
17
 
14
18
  beforeEach(() => {
15
19
  mountFunction = (options = {}) => {
16
20
  return mount(VListItem, {
21
+ global: {
22
+ stubs: {
23
+ 'router-link': Vue3RouterLinkStub,
24
+ },
25
+ ...options.global,
26
+ },
17
27
  ...options,
18
28
  })
19
29
  }
@@ -21,80 +31,70 @@ describe('VListItem.ts', () => {
21
31
 
22
32
  it('should render with a div when inactive is true and href is used', () => {
23
33
  const wrapper = mountFunction({
24
- propsData: {
34
+ props: {
25
35
  href: 'http://www.google.com',
26
36
  inactive: true,
27
37
  },
28
38
  })
29
39
 
30
- expect(wrapper.is('div')).toBe(true)
40
+ expect(wrapper.element.tagName.toLowerCase()).toBe('div')
31
41
  expect(wrapper.classes('v-list-item--link')).toBe(false)
32
42
  })
33
43
 
34
44
  it('should render with a tag when tag is specified', () => {
35
45
  const wrapper = mountFunction({
36
- propsData: {
46
+ props: {
37
47
  tag: 'code',
38
48
  },
39
49
  })
40
50
 
41
- expect(wrapper.is('code')).toBe(true)
51
+ expect(wrapper.element.tagName.toLowerCase()).toBe('code')
42
52
  })
43
53
 
44
54
  it('should render with a div when href and to are not used', () => {
45
55
  const wrapper = mountFunction()
46
56
 
47
- expect(wrapper.is('div')).toBe(true)
57
+ expect(wrapper.element.tagName.toLowerCase()).toBe('div')
48
58
  expect(wrapper.html()).toMatchSnapshot()
49
59
  })
50
60
 
51
61
  it('should render with <a> when using href prop', () => {
52
62
  const wrapper = mountFunction({
53
- propsData: {
63
+ props: {
54
64
  href: 'http://www.google.com',
55
65
  },
56
66
  })
57
67
 
58
68
  const a = wrapper.find('a')
59
69
 
60
- expect(wrapper.is('a')).toBe(true)
70
+ expect(wrapper.element.tagName.toLowerCase()).toBe('a')
61
71
  expect(a.element.getAttribute('href')).toBe('http://www.google.com')
62
72
  expect(wrapper.html()).toMatchSnapshot()
63
73
  })
64
74
 
65
- it('should have --link class when href/to prop present or link prop is used', () => {
75
+ it('should have --link class when href/to prop present or link prop is used', async () => {
66
76
  const wrapper = mountFunction({
67
- propsData: {
77
+ props: {
68
78
  href: '/home',
69
79
  },
70
80
  })
71
81
 
72
82
  expect(wrapper.classes('v-list-item--link')).toBe(true)
73
83
 
74
- wrapper.setProps({ href: undefined, to: '/foo' })
84
+ await wrapper.setProps({ href: undefined, to: '/foo' })
75
85
  expect(wrapper.classes('v-list-item--link')).toBe(true)
76
86
 
77
- wrapper.setProps({ to: undefined, link: true })
87
+ await wrapper.setProps({ to: undefined, link: true })
78
88
  expect(wrapper.classes('v-list-item--link')).toBe(true)
79
89
 
80
- wrapper.setProps({ link: false })
90
+ await wrapper.setProps({ link: false })
81
91
  expect(wrapper.classes('v-list-item--link')).toBe(false)
82
92
  })
83
93
 
84
94
  it('should have --link class when click handler present', () => {
85
95
  const wrapper = mountFunction({
86
- listeners: {
87
- click: () => {},
88
- },
89
- })
90
-
91
- expect(wrapper.classes('v-list-item--link')).toBe(true)
92
- })
93
-
94
- it('should have --link class when click.prevent.stop handler present', () => {
95
- const wrapper = mountFunction({
96
- listeners: {
97
- '!click': () => {},
96
+ props: {
97
+ link: true,
98
98
  },
99
99
  })
100
100
 
@@ -103,7 +103,7 @@ describe('VListItem.ts', () => {
103
103
 
104
104
  it('should have --selectable class if the selectable property is true', () => {
105
105
  const wrapper = mountFunction({
106
- propsData: {
106
+ props: {
107
107
  selectable: true,
108
108
  },
109
109
  })
@@ -111,81 +111,82 @@ describe('VListItem.ts', () => {
111
111
  expect(wrapper.classes('v-list-item--selectable')).toBe(true)
112
112
  })
113
113
 
114
- it('should react to keydown.enter', () => {
114
+ it('should react to keydown.enter', async () => {
115
115
  const click = jest.fn()
116
- const wrapper = mountFunction({
117
- methods: { click },
118
- })
116
+ const wrapper = mountFunction({})
119
117
 
120
- wrapper.trigger('keydown.enter')
118
+ // Мокируем метод click компонента
119
+ wrapper.vm.click = click
120
+
121
+ await wrapper.trigger('keydown.enter')
121
122
 
122
123
  expect(click).toHaveBeenCalled()
123
124
  })
124
125
 
125
126
  it('should react to clicks', async () => {
126
127
  const blur = jest.fn()
127
- const click = jest.fn()
128
128
  const toggle = jest.fn()
129
- const wrapper = mountFunction({
130
- methods: { toggle },
131
- })
129
+ const wrapper = mountFunction({})
132
130
 
133
131
  wrapper.vm.$el.blur = blur
134
- wrapper.vm.$on('click', click)
132
+ wrapper.vm.toggle = toggle
135
133
 
136
- wrapper.trigger('click')
134
+ await wrapper.trigger('click')
137
135
  expect(blur).not.toHaveBeenCalled()
138
- expect(click).toHaveBeenCalled()
136
+ expect(wrapper.emitted('click')).toBeTruthy()
139
137
  expect(toggle).toHaveBeenCalled()
140
138
 
141
139
  wrapper.vm.click({ detail: 1 })
142
140
 
143
141
  expect(blur).toHaveBeenCalled()
144
142
 
145
- wrapper.setProps({ to: '/foo' })
143
+ await wrapper.setProps({ to: '/foo' })
146
144
  await wrapper.vm.$nextTick()
147
145
 
148
146
  expect(toggle).toHaveBeenCalledTimes(2)
149
- wrapper.trigger('click')
147
+ await wrapper.trigger('click')
150
148
  expect(toggle).toHaveBeenCalledTimes(2)
151
149
  })
152
150
 
153
151
  it('should inherit listItemGroup activeClass', () => {
154
152
  const wrapper = mountFunction({
155
- provide: {
156
- listItemGroup: {
157
- activeClass: 'foobar',
158
- register: () => {},
159
- unregister: () => {},
153
+ global: {
154
+ provide: {
155
+ listItemGroup: {
156
+ activeClass: 'foobar',
157
+ register: () => {},
158
+ unregister: () => {},
159
+ },
160
160
  },
161
161
  },
162
162
  })
163
163
 
164
- expect(wrapper.vm.activeClass).toBe('foobar')
164
+ expect(wrapper.vm.$activeClass).toBe('foobar')
165
165
  })
166
166
 
167
- it('should have the correct aria attributes and tabindex', () => {
167
+ it('should have the correct aria attributes and tabindex', async () => {
168
168
  const wrapper = mountFunction({
169
- propsData: { disabled: true },
169
+ props: { disabled: true },
170
170
  })
171
171
 
172
172
  expect(wrapper.element.getAttribute('aria-disabled')).toBe('true')
173
173
  expect(wrapper.element.tabIndex).toBe(-1)
174
174
 
175
- wrapper.setProps({
175
+ await wrapper.setProps({
176
176
  disabled: false,
177
- inputValue: true,
177
+ modelValue: true,
178
178
  })
179
179
 
180
180
  expect(wrapper.element.getAttribute('aria-disabled')).toBeNull()
181
181
  expect(wrapper.element.tabIndex).toBe(-1)
182
182
 
183
- wrapper.setProps({ link: true })
183
+ await wrapper.setProps({ link: true })
184
+ await wrapper.vm.$nextTick()
184
185
 
185
186
  expect(wrapper.element.tabIndex).toBe(0)
186
187
  })
187
188
 
188
- it('should have the correct role', () => {
189
+ it('should have the correct role', async () => {
189
190
  // Custom provided
190
191
  const wrapper = mountFunction({
191
192
  attrs: { role: 'item' },
@@ -194,27 +195,37 @@ describe('VListItem.ts', () => {
194
195
 
195
196
  // In nav
196
197
  const wrapper2 = mountFunction({
197
- provide: { isInNav: true },
198
+ global: {
199
+ provide: { isInNav: true },
200
+ },
198
201
  })
199
202
  expect(wrapper2.element.getAttribute('role')).toBeNull()
200
203
 
201
204
  // In list-item-group
202
205
  const wrapper3 = mountFunction({
203
- provide: { isInGroup: true },
206
+ global: {
207
+ provide: { isInGroup: true },
208
+ },
204
209
  })
205
210
  expect(wrapper3.element.getAttribute('role')).toBe('option')
211
+ expect(wrapper3.element.getAttribute('aria-selected')).toBe('false')
206
212
 
207
213
  // In menu
208
214
  const wrapper4 = mountFunction({
209
- provide: { isInMenu: true },
215
+ global: {
216
+ provide: { isInMenu: true },
217
+ },
210
218
  })
211
219
  expect(wrapper4.element.getAttribute('role')).toBeNull()
212
- wrapper4.setProps({ href: '#' }) // could be `to` or `link` as well
220
+ await wrapper4.setProps({ href: '#' }) // could be `to` or `link` as well
213
221
  expect(wrapper4.element.getAttribute('role')).toBe('menuitem')
222
+ expect(wrapper4.element.getAttribute('id')).toMatch(/^list-item-\d+$/)
214
223
 
215
224
  // In list not a link
216
225
  const wrapper5 = mountFunction({
217
- provide: { isInList: true },
226
+ global: {
227
+ provide: { isInList: true },
228
+ },
218
229
  })
219
230
  expect(wrapper5.element.getAttribute('role')).toBe('listitem')
220
231
  })
@@ -228,22 +239,90 @@ describe('VListItem.ts', () => {
228
239
  wrapper.vm.toggle()
229
240
  expect(wrapper.vm.isActive).toBeFalsy()
230
241
 
231
- const wrapper2 = mountFunction({ propsData: { to: { name: 'test' } }, stubs: ['router-link'] })
242
+ const wrapper2 = mountFunction({
243
+ props: { to: { name: 'test' } },
244
+ global: {
245
+ stubs: {
246
+ 'router-link': Vue3RouterLinkStub,
247
+ },
248
+ },
249
+ })
232
250
 
233
251
  expect(wrapper2.vm.isActive).toBeFalsy()
234
252
  wrapper2.vm.toggle()
235
253
  expect(wrapper2.vm.isActive).toBeTruthy()
236
254
  })
237
255
 
238
- it('should not react to keydown.enter when disabled', () => {
256
+ it('should not react to keydown.enter when disabled', async () => {
239
257
  const click = jest.fn()
240
258
  const wrapper = mountFunction({
241
- methods: { click },
242
- propsData: { disabled: true },
259
+ global: {
260
+ mocks: { click },
261
+ },
262
+ props: { disabled: true },
243
263
  })
244
264
 
245
- wrapper.trigger('keydown.enter')
265
+ await wrapper.trigger('keydown.enter')
246
266
 
247
267
  expect(click).not.toHaveBeenCalled()
248
268
  })
269
+
270
+ it('should be clickable when href is provided', () => {
271
+ const wrapper = mountFunction({
272
+ props: {
273
+ href: 'http://www.google.com',
274
+ },
275
+ })
276
+
277
+ expect(wrapper.vm.isClickable).toBe(true)
278
+ })
279
+
280
+ it('should be clickable when to is provided', () => {
281
+ const wrapper = mountFunction({
282
+ props: {
283
+ to: '/home',
284
+ },
285
+ })
286
+
287
+ expect(wrapper.vm.isClickable).toBe(true)
288
+ })
289
+
290
+ it('should be clickable when in listItemGroup', () => {
291
+ const wrapper = mountFunction({
292
+ global: {
293
+ provide: {
294
+ listItemGroup: {
295
+ register: () => {},
296
+ unregister: () => {},
297
+ },
298
+ },
299
+ },
300
+ })
301
+
302
+ expect(wrapper.vm.isClickable).toBe(true)
303
+ })
304
+
305
+ it('should not be clickable when no href, to, or listItemGroup', () => {
306
+ const wrapper = mountFunction()
307
+
308
+ expect(wrapper.vm.isClickable).toBe(false)
309
+ })
310
+
311
+ it('should be clickable when both href and listItemGroup are present', () => {
312
+ const wrapper = mountFunction({
313
+ props: {
314
+ href: 'http://www.google.com',
315
+ },
316
+ global: {
317
+ provide: {
318
+ listItemGroup: {
319
+ register: () => {},
320
+ unregister: () => {},
321
+ },
322
+ },
323
+ },
324
+ })
325
+
326
+ expect(wrapper.vm.isClickable).toBe(true)
327
+ })
249
328
  })
@@ -4,7 +4,8 @@ import VListItemAvatar from '../VListItemAvatar'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- Wrapper,
7
+ VueWrapper,
8
+ enableAutoUnmount,
8
9
  } from '@vue/test-utils'
9
10
 
10
11
  // Types
@@ -12,7 +13,9 @@ import { ExtractVue } from '../../../util/mixins'
12
13
 
13
14
  describe('VListItemAvatar.ts', () => {
14
15
  type Instance = ExtractVue<typeof VListItemAvatar>
15
- let mountFunction: (options?: object) => Wrapper<Instance>
16
+ let mountFunction: (options?: object) => VueWrapper<Instance>
17
+
18
+ enableAutoUnmount(afterEach)
16
19
 
17
20
  beforeEach(() => {
18
21
  mountFunction = (options = {}) => {
@@ -4,12 +4,15 @@ import VListItemGroup from '../VListItemGroup'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- Wrapper,
7
+ VueWrapper,
8
+ enableAutoUnmount,
8
9
  } from '@vue/test-utils'
9
10
 
10
11
  describe('VListItemGroup.ts', () => {
11
12
  type Instance = InstanceType<typeof VListItemGroup>
12
- let mountFunction: (options?: object) => Wrapper<Instance>
13
+ let mountFunction: (options?: object) => VueWrapper<Instance>
14
+
15
+ enableAutoUnmount(afterEach)
13
16
 
14
17
  beforeEach(() => {
15
18
  mountFunction = (options = {}) => {
@@ -1,36 +1,36 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`VList.ts should render a dense component and match snapshot 1`] = `
4
- <div role="list"
5
- class="v-list v-sheet theme--light v-list--dense"
4
+ <div class="v-sheet theme--light v-list--dense v-list"
5
+ role="list"
6
6
  >
7
7
  </div>
8
8
  `;
9
9
 
10
10
  exports[`VList.ts should render a subheader component and match snapshot 1`] = `
11
- <div role="list"
12
- class="v-list v-sheet theme--light v-list--subheader"
11
+ <div class="v-sheet theme--light v-list--subheader v-list"
12
+ role="list"
13
13
  >
14
14
  </div>
15
15
  `;
16
16
 
17
17
  exports[`VList.ts should render a threeLine component and match snapshot 1`] = `
18
- <div role="list"
19
- class="v-list v-sheet theme--light v-list--three-line"
18
+ <div class="v-sheet theme--light v-list--three-line v-list"
19
+ role="list"
20
20
  >
21
21
  </div>
22
22
  `;
23
23
 
24
24
  exports[`VList.ts should render a twoLine component and match snapshot 1`] = `
25
- <div role="list"
26
- class="v-list v-sheet theme--light v-list--two-line"
25
+ <div class="v-sheet theme--light v-list--two-line v-list"
26
+ role="list"
27
27
  >
28
28
  </div>
29
29
  `;
30
30
 
31
31
  exports[`VList.ts should render component and match snapshot 1`] = `
32
- <div role="list"
33
- class="v-list v-sheet theme--light"
32
+ <div class="v-sheet theme--light v-list"
33
+ role="list"
34
34
  >
35
35
  </div>
36
36
  `;
@@ -2,16 +2,15 @@
2
2
 
3
3
  exports[`VListGroup.ts should render component and match snapshot 1`] = `
4
4
  <div class="v-list-group">
5
- <div tabindex="0"
6
- aria-expanded="false"
5
+ <div aria-expanded="false"
7
6
  role="button"
8
- class="v-list-group__header v-list-item v-list-item--link theme--light"
7
+ tabindex="0"
8
+ class="v-list-item v-list-item--link theme--light v-list-group__header"
9
9
  >
10
- <div class="v-list-item__icon v-list-group__header__append-icon">
10
+ <div class="v-list-item__icon v-list-group__header__append-icon v-list-group__header__append-icon">
11
11
  <i aria-hidden="true"
12
- class="v-icon notranslate material-icons theme--light"
12
+ class="v-icon notranslate mdi mdi-chevron-down theme--light"
13
13
  >
14
- $expand
15
14
  </i>
16
15
  </div>
17
16
  </div>
@@ -2,8 +2,8 @@
2
2
 
3
3
  exports[`VListItem.ts should render with <a> when using href prop 1`] = `
4
4
  <a tabindex="0"
5
- href="http://www.google.com"
6
5
  class="v-list-item v-list-item--link theme--light"
6
+ href="http://www.google.com"
7
7
  >
8
8
  </a>
9
9
  `;
@@ -2,30 +2,27 @@
2
2
  import VMain from '../VMain'
3
3
 
4
4
  // Utilities
5
- import {
6
- mount,
7
- MountOptions,
8
- Wrapper,
9
- } from '@vue/test-utils'
5
+ import { mount } from '@vue/test-utils'
10
6
 
11
7
  describe('VMain.ts', () => {
12
- type Instance = InstanceType<typeof VMain>
13
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
8
+ let mountFunction: (options?: any) => any
14
9
 
15
10
  beforeEach(() => {
16
11
  mountFunction = (options = {}) => {
17
12
  return mount(VMain, {
18
13
  ...options,
19
- mocks: {
20
- $vuetify: {
21
- application: {
22
- bar: 24,
23
- top: 64,
24
- left: 256,
25
- right: 256,
26
- footer: 48,
27
- insetFooter: 32,
28
- bottom: 56,
14
+ global: {
15
+ mocks: {
16
+ $vuetify: {
17
+ application: {
18
+ bar: 24,
19
+ top: 64,
20
+ left: 256,
21
+ right: 256,
22
+ footer: 48,
23
+ insetFooter: 32,
24
+ bottom: 56,
25
+ },
29
26
  },
30
27
  },
31
28
  },
@@ -38,4 +35,61 @@ describe('VMain.ts', () => {
38
35
 
39
36
  expect(wrapper.html()).toMatchSnapshot()
40
37
  })
38
+
39
+ it('should render custom tag', () => {
40
+ const wrapper = mountFunction({
41
+ props: {
42
+ tag: 'div'
43
+ }
44
+ })
45
+
46
+ expect(wrapper.element.tagName).toBe('DIV')
47
+ })
48
+
49
+ it('should apply correct styles based on vuetify application', () => {
50
+ const wrapper = mountFunction()
51
+ const mainElement = wrapper.element
52
+
53
+ expect(mainElement.style.paddingTop).toBe('88px') // 64 + 24
54
+ expect(mainElement.style.paddingRight).toBe('256px')
55
+ expect(mainElement.style.paddingBottom).toBe('136px') // 48 + 32 + 56
56
+ expect(mainElement.style.paddingLeft).toBe('256px')
57
+ })
58
+
59
+ it('should render with slot content', () => {
60
+ const wrapper = mountFunction({
61
+ slots: {
62
+ default: '<div>Test content</div>'
63
+ }
64
+ })
65
+
66
+ expect(wrapper.html()).toContain('Test content')
67
+ })
68
+
69
+ it('should render with complex slot content', () => {
70
+ const wrapper = mountFunction({
71
+ slots: {
72
+ default: [
73
+ '<div>First item</div>',
74
+ '<div>Second item</div>'
75
+ ]
76
+ }
77
+ })
78
+
79
+ expect(wrapper.html()).toContain('First item')
80
+ expect(wrapper.html()).toContain('Second item')
81
+ })
82
+
83
+ it('should have correct CSS classes', () => {
84
+ const wrapper = mountFunction()
85
+
86
+ expect(wrapper.classes()).toContain('v-main')
87
+ expect(wrapper.find('.v-main__wrap').exists()).toBe(true)
88
+ })
89
+
90
+ it('should render with default tag', () => {
91
+ const wrapper = mountFunction()
92
+
93
+ expect(wrapper.element.tagName).toBe('MAIN')
94
+ })
41
95
  })
@@ -303,7 +303,7 @@ export default baseMixins.extend({
303
303
  const listeners = Menuable.methods.genActivatorListeners.call(this)
304
304
 
305
305
  if (!this.disableKeys) {
306
- listeners.keydown = this.onKeyDown
306
+ listeners.onKeydown = this.onKeyDown;
307
307
  }
308
308
 
309
309
  return listeners