@dimailn/vuetify 2.7.2-alpha20 → 2.7.2-alpha22

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 (98) hide show
  1. package/dist/vuetify.js +214 -84
  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/VOverlay/VOverlay.js +2 -3
  6. package/es5/components/VOverlay/VOverlay.js.map +1 -1
  7. package/es5/components/VProgressCircular/VProgressCircular.js +5 -3
  8. package/es5/components/VProgressCircular/VProgressCircular.js.map +1 -1
  9. package/es5/components/VProgressLinear/VProgressLinear.js +41 -19
  10. package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
  11. package/es5/components/VTabs/VTabs.js +1 -1
  12. package/es5/components/VTabs/VTabs.js.map +1 -1
  13. package/es5/components/VTabs/VTabsBar.js.map +1 -1
  14. package/es5/components/VVirtualScroll/VVirtualScroll.js +15 -16
  15. package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  16. package/es5/components/VWindow/VWindow.js +13 -5
  17. package/es5/components/VWindow/VWindow.js.map +1 -1
  18. package/es5/components/VWindow/VWindowItem.js +9 -5
  19. package/es5/components/VWindow/VWindowItem.js.map +1 -1
  20. package/es5/framework.js +1 -1
  21. package/es5/install.js +10 -33
  22. package/es5/install.js.map +1 -1
  23. package/es5/mixins/detachable/index.js +2 -3
  24. package/es5/mixins/detachable/index.js.map +1 -1
  25. package/es5/mixins/overlayable/index.js.map +1 -1
  26. package/es5/util/helpers.js +44 -0
  27. package/es5/util/helpers.js.map +1 -1
  28. package/es5/util/legacyEventsMixin.js +48 -0
  29. package/es5/util/legacyEventsMixin.js.map +1 -0
  30. package/lib/components/VOverlay/VOverlay.js +1 -2
  31. package/lib/components/VOverlay/VOverlay.js.map +1 -1
  32. package/lib/components/VProgressCircular/VProgressCircular.js +5 -3
  33. package/lib/components/VProgressCircular/VProgressCircular.js.map +1 -1
  34. package/lib/components/VProgressLinear/VProgressLinear.js +35 -17
  35. package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
  36. package/lib/components/VTabs/VTabs.js +1 -1
  37. package/lib/components/VTabs/VTabs.js.map +1 -1
  38. package/lib/components/VTabs/VTabsBar.js.map +1 -1
  39. package/lib/components/VVirtualScroll/VVirtualScroll.js +8 -11
  40. package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  41. package/lib/components/VWindow/VWindow.js +7 -3
  42. package/lib/components/VWindow/VWindow.js.map +1 -1
  43. package/lib/components/VWindow/VWindowItem.js +3 -1
  44. package/lib/components/VWindow/VWindowItem.js.map +1 -1
  45. package/lib/framework.js +1 -1
  46. package/lib/install.js +5 -28
  47. package/lib/install.js.map +1 -1
  48. package/lib/mixins/detachable/index.js +3 -4
  49. package/lib/mixins/detachable/index.js.map +1 -1
  50. package/lib/mixins/overlayable/index.js.map +1 -1
  51. package/lib/util/helpers.js +42 -0
  52. package/lib/util/helpers.js.map +1 -1
  53. package/lib/util/legacyEventsMixin.js +37 -0
  54. package/lib/util/legacyEventsMixin.js.map +1 -0
  55. package/package.json +1 -1
  56. package/src/components/VAvatar/__tests__/VAvatar.spec.ts +72 -10
  57. package/src/components/VOverlay/VOverlay.ts +1 -1
  58. package/src/components/VOverlay/__tests__/VOverlay.spec.ts +6 -6
  59. package/src/components/VProgressCircular/VProgressCircular.ts +6 -5
  60. package/src/components/VProgressCircular/__tests__/VProgressCircular.spec.ts +28 -21
  61. package/src/components/VProgressCircular/__tests__/__snapshots__/VProgressCircular.spec.ts.snap +62 -62
  62. package/src/components/VProgressLinear/VProgressLinear.ts +42 -22
  63. package/src/components/VProgressLinear/__tests__/VProgressLinear.spec.ts +378 -71
  64. package/src/components/VProgressLinear/__tests__/__snapshots__/VProgressLinear.spec.ts.snap +53 -79
  65. package/src/components/VSheet/__tests__/VSheet.spec.ts +5 -5
  66. package/src/components/VTabs/VTabs.ts +1 -1
  67. package/src/components/VTabs/VTabsBar.ts +7 -5
  68. package/src/components/VTabs/__tests__/VTab.spec.ts +48 -37
  69. package/src/components/VTabs/__tests__/VTabs.spec.ts +134 -79
  70. package/src/components/VTabs/__tests__/VTabsBar.spec.ts +67 -26
  71. package/src/components/VTabs/__tests__/VTabsSlider.spec.ts +7 -6
  72. package/src/components/VTabs/__tests__/__snapshots__/VTabs.spec.ts.snap +1 -3
  73. package/src/components/VVirtualScroll/VVirtualScroll.ts +14 -13
  74. package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +26 -19
  75. package/src/components/VWindow/VWindow.ts +9 -5
  76. package/src/components/VWindow/VWindowItem.ts +3 -1
  77. package/src/components/VWindow/__tests__/VWindow.spec.ts +226 -185
  78. package/src/components/VWindow/__tests__/VWindowItem.spec.ts +162 -132
  79. package/src/install.ts +10 -32
  80. package/src/mixins/applicationable/__tests__/applicationable.spec.ts +31 -27
  81. package/src/mixins/colorable/__tests__/colorable.spec.ts +9 -6
  82. package/src/mixins/detachable/index.ts +2 -1
  83. package/src/mixins/elevatable/__tests__/elevatable.spec.ts +14 -13
  84. package/src/mixins/intersectable/__tests__/intersectable.spec.ts +35 -29
  85. package/src/mixins/menuable/__tests__/menuable.spec.ts +76 -33
  86. package/src/mixins/mobile/__tests__/mobile.spec.ts +9 -6
  87. package/src/mixins/overlayable/__tests__/overlayable.spec.ts +32 -24
  88. package/src/mixins/overlayable/index.ts +1 -1
  89. package/src/mixins/proxyable/__tests__/proxyable.spec.ts +18 -17
  90. package/src/mixins/registrable/__tests__/registrable.spec.ts +31 -0
  91. package/src/mixins/rippleable/__tests__/rippleable.spec.ts +10 -9
  92. package/src/mixins/roundable/__tests__/roundable.spec.ts +7 -5
  93. package/src/mixins/routable/__tests__/routable.spec.ts +60 -52
  94. package/src/mixins/scrollable/__tests__/scrollable.spec.ts +56 -27
  95. package/src/mixins/selectable/__tests__/selectable.spec.ts +22 -9
  96. package/src/util/__tests__/helpers.spec.ts +62 -1
  97. package/src/util/helpers.ts +42 -1
  98. package/src/util/legacyEventsMixin.ts +34 -0
@@ -1,13 +1,17 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`VProgressLinear.ts should render component and match snapshot 1`] = `
4
- <div role="progressbar"
3
+ exports[`VProgressLinear.ts should render a stream component 1`] = `
4
+ <div class="v-progress-linear theme--light"
5
+ role="progressbar"
5
6
  aria-valuemin="0"
6
7
  aria-valuemax="100"
7
8
  aria-valuenow="33"
8
- class="v-progress-linear theme--light"
9
9
  style="height: 4px;"
10
10
  >
11
+ <div class="v-progress-linear__stream primary--text"
12
+ style="width: 0%;"
13
+ >
14
+ </div>
11
15
  <div class="v-progress-linear__background primary"
12
16
  style="opacity: 0.3; left: 33%; width: 67%;"
13
17
  >
@@ -21,16 +25,16 @@ exports[`VProgressLinear.ts should render component and match snapshot 1`] = `
21
25
  </div>
22
26
  `;
23
27
 
24
- exports[`VProgressLinear.ts should render component in RTL mode 1`] = `
25
- <div role="progressbar"
28
+ exports[`VProgressLinear.ts should render component and match snapshot 1`] = `
29
+ <div class="v-progress-linear theme--light"
30
+ role="progressbar"
26
31
  aria-valuemin="0"
27
32
  aria-valuemax="100"
28
33
  aria-valuenow="33"
29
- class="v-progress-linear v-progress-linear--reverse theme--light"
30
34
  style="height: 4px;"
31
35
  >
32
36
  <div class="v-progress-linear__background primary"
33
- style="opacity: 0.3; right: 33%; width: 67%;"
37
+ style="opacity: 0.3; left: 33%; width: 67%;"
34
38
  >
35
39
  </div>
36
40
  <div class="v-progress-linear__buffer">
@@ -42,21 +46,19 @@ exports[`VProgressLinear.ts should render component in RTL mode 1`] = `
42
46
  </div>
43
47
  `;
44
48
 
45
- exports[`VProgressLinear.ts should render component with buffer value and match snapshot 1`] = `
46
- <div role="progressbar"
49
+ exports[`VProgressLinear.ts should render component in RTL mode 1`] = `
50
+ <div class="v-progress-linear v-progress-linear--reverse theme--light"
51
+ role="progressbar"
47
52
  aria-valuemin="0"
48
- aria-valuemax="80"
53
+ aria-valuemax="100"
49
54
  aria-valuenow="33"
50
- class="v-progress-linear theme--light"
51
55
  style="height: 4px;"
52
56
  >
53
57
  <div class="v-progress-linear__background primary"
54
- style="opacity: 0.3; left: 33%; width: 47%;"
58
+ style="opacity: 0.3; right: 33%; width: 67%;"
55
59
  >
56
60
  </div>
57
- <div class="v-progress-linear__buffer"
58
- style="width: 80%;"
59
- >
61
+ <div class="v-progress-linear__buffer">
60
62
  </div>
61
63
  <div class="v-progress-linear__determinate primary"
62
64
  style="width: 33%;"
@@ -65,20 +67,20 @@ exports[`VProgressLinear.ts should render component with buffer value and match
65
67
  </div>
66
68
  `;
67
69
 
68
- exports[`VProgressLinear.ts should render component with buffer value and match snapshot 2`] = `
69
- <div role="progressbar"
70
+ exports[`VProgressLinear.ts should render component with buffer value and match snapshot 1`] = `
71
+ <div class="v-progress-linear theme--light"
72
+ role="progressbar"
70
73
  aria-valuemin="0"
71
- aria-valuemax="0"
74
+ aria-valuemax="80"
72
75
  aria-valuenow="33"
73
- class="v-progress-linear theme--light"
74
76
  style="height: 4px;"
75
77
  >
76
78
  <div class="v-progress-linear__background primary"
77
- style="opacity: 0.3; left: 33%; width: 0%;"
79
+ style="opacity: 0.3; left: 33%; width: 47%;"
78
80
  >
79
81
  </div>
80
82
  <div class="v-progress-linear__buffer"
81
- style="width: 0%;"
83
+ style="width: 80%;"
82
84
  >
83
85
  </div>
84
86
  <div class="v-progress-linear__determinate primary"
@@ -89,11 +91,11 @@ exports[`VProgressLinear.ts should render component with buffer value and match
89
91
  `;
90
92
 
91
93
  exports[`VProgressLinear.ts should render component with buffer value and value > buffer value and match snapshot 1`] = `
92
- <div role="progressbar"
94
+ <div class="v-progress-linear theme--light"
95
+ role="progressbar"
93
96
  aria-valuemin="0"
94
97
  aria-valuemax="80"
95
98
  aria-valuenow="90"
96
- class="v-progress-linear theme--light"
97
99
  style="height: 4px;"
98
100
  >
99
101
  <div class="v-progress-linear__background primary"
@@ -112,11 +114,11 @@ exports[`VProgressLinear.ts should render component with buffer value and value
112
114
  `;
113
115
 
114
116
  exports[`VProgressLinear.ts should render component with color and background color and match snapshot 1`] = `
115
- <div role="progressbar"
117
+ <div class="v-progress-linear theme--light"
118
+ role="progressbar"
116
119
  aria-valuemin="0"
117
120
  aria-valuemax="100"
118
121
  aria-valuenow="33"
119
- class="v-progress-linear theme--light"
120
122
  style="height: 4px;"
121
123
  >
122
124
  <div class="v-progress-linear__background blue"
@@ -125,7 +127,7 @@ exports[`VProgressLinear.ts should render component with color and background co
125
127
  </div>
126
128
  <div class="v-progress-linear__buffer">
127
129
  </div>
128
- <div class="v-progress-linear__determinate orange"
130
+ <div class="v-progress-linear__determinate red"
129
131
  style="width: 33%;"
130
132
  >
131
133
  </div>
@@ -133,11 +135,11 @@ exports[`VProgressLinear.ts should render component with color and background co
133
135
  `;
134
136
 
135
137
  exports[`VProgressLinear.ts should render component with color and background color and opacity and match snapshot 1`] = `
136
- <div role="progressbar"
138
+ <div class="v-progress-linear theme--light"
139
+ role="progressbar"
137
140
  aria-valuemin="0"
138
141
  aria-valuemax="100"
139
142
  aria-valuenow="33"
140
- class="v-progress-linear theme--light"
141
143
  style="height: 4px;"
142
144
  >
143
145
  <div class="v-progress-linear__background blue"
@@ -146,7 +148,7 @@ exports[`VProgressLinear.ts should render component with color and background co
146
148
  </div>
147
149
  <div class="v-progress-linear__buffer">
148
150
  </div>
149
- <div class="v-progress-linear__determinate orange"
151
+ <div class="v-progress-linear__determinate red"
150
152
  style="width: 33%;"
151
153
  >
152
154
  </div>
@@ -154,20 +156,20 @@ exports[`VProgressLinear.ts should render component with color and background co
154
156
  `;
155
157
 
156
158
  exports[`VProgressLinear.ts should render component with color and background opacity and match snapshot 1`] = `
157
- <div role="progressbar"
159
+ <div class="v-progress-linear theme--light"
160
+ role="progressbar"
158
161
  aria-valuemin="0"
159
162
  aria-valuemax="100"
160
163
  aria-valuenow="33"
161
- class="v-progress-linear theme--light"
162
164
  style="height: 4px;"
163
165
  >
164
- <div class="v-progress-linear__background orange"
166
+ <div class="v-progress-linear__background red"
165
167
  style="opacity: 0.5; left: 33%; width: 67%;"
166
168
  >
167
169
  </div>
168
170
  <div class="v-progress-linear__buffer">
169
171
  </div>
170
- <div class="v-progress-linear__determinate orange"
172
+ <div class="v-progress-linear__determinate red"
171
173
  style="width: 33%;"
172
174
  >
173
175
  </div>
@@ -175,20 +177,20 @@ exports[`VProgressLinear.ts should render component with color and background op
175
177
  `;
176
178
 
177
179
  exports[`VProgressLinear.ts should render component with color and match snapshot 1`] = `
178
- <div role="progressbar"
180
+ <div class="v-progress-linear theme--light"
181
+ role="progressbar"
179
182
  aria-valuemin="0"
180
183
  aria-valuemax="100"
181
184
  aria-valuenow="33"
182
- class="v-progress-linear theme--light"
183
185
  style="height: 4px;"
184
186
  >
185
- <div class="v-progress-linear__background orange"
187
+ <div class="v-progress-linear__background red"
186
188
  style="opacity: 0.3; left: 33%; width: 67%;"
187
189
  >
188
190
  </div>
189
191
  <div class="v-progress-linear__buffer">
190
192
  </div>
191
- <div class="v-progress-linear__determinate orange"
193
+ <div class="v-progress-linear__determinate red"
192
194
  style="width: 33%;"
193
195
  >
194
196
  </div>
@@ -196,60 +198,32 @@ exports[`VProgressLinear.ts should render component with color and match snapsho
196
198
  `;
197
199
 
198
200
  exports[`VProgressLinear.ts should render component with css color and match snapshot 1`] = `
199
- <div role="progressbar"
201
+ <div class="v-progress-linear theme--light"
202
+ role="progressbar"
200
203
  aria-valuemin="0"
201
204
  aria-valuemax="100"
202
205
  aria-valuenow="33"
203
- class="v-progress-linear theme--light"
204
206
  style="height: 4px;"
205
207
  >
206
208
  <div class="v-progress-linear__background"
207
- style="opacity: 0.3; left: 33%; width: 67%; background-color: rgb(51, 102, 153); border-color: #336699;"
209
+ style="opacity: 0.3; left: 33%; width: 67%; background-color: rgb(255, 0, 0); border-color: #ff0000;"
208
210
  >
209
211
  </div>
210
212
  <div class="v-progress-linear__buffer">
211
213
  </div>
212
214
  <div class="v-progress-linear__determinate"
213
- style="width: 33%; background-color: rgb(51, 102, 153); border-color: #336699;"
215
+ style="width: 33%; background-color: rgb(255, 0, 0); border-color: #ff0000;"
214
216
  >
215
217
  </div>
216
218
  </div>
217
219
  `;
218
220
 
219
- exports[`VProgressLinear.ts should render default slot content 1`] = `
220
- <div role="progressbar"
221
- aria-valuemin="0"
222
- aria-valuemax="80"
223
- aria-valuenow="90"
224
- class="v-progress-linear theme--light"
225
- style="height: 4px;"
226
- >
227
- <div class="v-progress-linear__background primary"
228
- style="opacity: 0.3; left: 90%; width: 0%;"
229
- >
230
- </div>
231
- <div class="v-progress-linear__buffer"
232
- style="width: 80%;"
233
- >
234
- </div>
235
- <div class="v-progress-linear__determinate primary"
236
- style="width: 90%;"
237
- >
238
- </div>
239
- <div class="v-progress-linear__content">
240
- <div class="foobar">
241
- content
242
- </div>
243
- </div>
244
- </div>
245
- `;
246
-
247
221
  exports[`VProgressLinear.ts should render inactive component and match snapshot 1`] = `
248
- <div role="progressbar"
222
+ <div class="v-progress-linear theme--light"
223
+ role="progressbar"
249
224
  aria-valuemin="0"
250
225
  aria-valuemax="100"
251
226
  aria-valuenow="33"
252
- class="v-progress-linear theme--light"
253
227
  style="height: 0px;"
254
228
  >
255
229
  <div class="v-progress-linear__background primary"
@@ -268,10 +242,10 @@ exports[`VProgressLinear.ts should render inactive component and match snapshot
268
242
  `;
269
243
 
270
244
  exports[`VProgressLinear.ts should render indeterminate progress and match snapshot 1`] = `
271
- <div role="progressbar"
245
+ <div class="v-progress-linear theme--light"
246
+ role="progressbar"
272
247
  aria-valuemin="0"
273
248
  aria-valuemax="100"
274
- class="v-progress-linear theme--light"
275
249
  style="height: 4px;"
276
250
  >
277
251
  <div class="v-progress-linear__background primary"
@@ -290,10 +264,10 @@ exports[`VProgressLinear.ts should render indeterminate progress and match snaps
290
264
  `;
291
265
 
292
266
  exports[`VProgressLinear.ts should render indeterminate progress with query prop and match snapshot 1`] = `
293
- <div role="progressbar"
267
+ <div class="v-progress-linear v-progress-linear--query theme--light"
268
+ role="progressbar"
294
269
  aria-valuemin="0"
295
270
  aria-valuemax="100"
296
- class="v-progress-linear v-progress-linear--query theme--light"
297
271
  style="height: 4px;"
298
272
  >
299
273
  <div class="v-progress-linear__background primary"
@@ -312,11 +286,11 @@ exports[`VProgressLinear.ts should render indeterminate progress with query prop
312
286
  `;
313
287
 
314
288
  exports[`VProgressLinear.ts should render reverse component in RTL mode 1`] = `
315
- <div role="progressbar"
289
+ <div class="v-progress-linear theme--light"
290
+ role="progressbar"
316
291
  aria-valuemin="0"
317
292
  aria-valuemax="100"
318
293
  aria-valuenow="33"
319
- class="v-progress-linear theme--light"
320
294
  style="height: 4px;"
321
295
  >
322
296
  <div class="v-progress-linear__background primary"
@@ -333,11 +307,11 @@ exports[`VProgressLinear.ts should render reverse component in RTL mode 1`] = `
333
307
  `;
334
308
 
335
309
  exports[`VProgressLinear.ts should render reversed component 1`] = `
336
- <div role="progressbar"
310
+ <div class="v-progress-linear v-progress-linear--reverse theme--light"
311
+ role="progressbar"
337
312
  aria-valuemin="0"
338
313
  aria-valuemax="100"
339
314
  aria-valuenow="33"
340
- class="v-progress-linear v-progress-linear--reverse theme--light"
341
315
  style="height: 4px;"
342
316
  >
343
317
  <div class="v-progress-linear__background primary"
@@ -1,5 +1,5 @@
1
1
  // Libraries
2
- import Vue from 'vue'
2
+ import { defineComponent } from 'vue'
3
3
 
4
4
  // Components
5
5
  import VSheet from '../VSheet'
@@ -7,11 +7,11 @@ import VSheet from '../VSheet'
7
7
  // Utilities
8
8
  import {
9
9
  shallowMount,
10
- Wrapper,
10
+ VueWrapper,
11
11
  } from '@vue/test-utils'
12
12
 
13
13
  describe('VSheet.ts', () => {
14
- let mountFunction: (options?: object) => Wrapper<Vue>
14
+ let mountFunction: (options?: Record<string, any>) => VueWrapper<any>
15
15
 
16
16
  beforeEach(() => {
17
17
  mountFunction = (options = {}) => {
@@ -27,7 +27,7 @@ describe('VSheet.ts', () => {
27
27
 
28
28
  it('should render a colored paper', () => {
29
29
  const wrapper = mountFunction({
30
- propsData: {
30
+ props: {
31
31
  color: 'blue lighten-1',
32
32
  },
33
33
  })
@@ -38,7 +38,7 @@ describe('VSheet.ts', () => {
38
38
 
39
39
  it('should render a tile paper', () => {
40
40
  const wrapper = mountFunction({
41
- propsData: {
41
+ props: {
42
42
  tile: true,
43
43
  },
44
44
  })
@@ -204,7 +204,7 @@ export default baseMixins.extend({
204
204
  nextIcon: this.nextIcon,
205
205
  prevIcon: this.prevIcon,
206
206
  showArrows: this.showArrows,
207
- value: this.internalValue,
207
+ modelValue: this.internalValue,
208
208
  'onCall:slider': this.callSlider,
209
209
  'onUpdate:modelValue': (val: any) => {
210
210
  this.internalValue = val
@@ -1,4 +1,4 @@
1
- import {h} from 'vue'
1
+ import { h, VNode } from 'vue'
2
2
  // Extensions
3
3
  import { BaseSlideGroup } from '../VSlideGroup/VSlideGroup'
4
4
 
@@ -13,8 +13,7 @@ import SSRBootable from '../../mixins/ssr-bootable'
13
13
  import mixins from '../../util/mixins'
14
14
 
15
15
  // Types
16
- import { Route } from 'vue-router'
17
- import { VNode } from 'vue'
16
+ import { RouteLocationNormalized } from 'vue-router'
18
17
 
19
18
  type VTabInstance = InstanceType<typeof VTab>
20
19
 
@@ -64,11 +63,14 @@ export default mixins(
64
63
 
65
64
  return render
66
65
  },
67
- onRouteChange (val: Route, oldVal: Route) {
66
+ onRouteChange (
67
+ val: RouteLocationNormalized,
68
+ oldVal: RouteLocationNormalized
69
+ ) {
68
70
  /* istanbul ignore next */
69
71
  if (this.mandatory) return
70
72
 
71
- const items = this.items as unknown as VTabInstance[]
73
+ const items = (this.items as unknown) as VTabInstance[]
72
74
  const newPath = val.path
73
75
  const oldPath = oldVal.path
74
76
 
@@ -5,15 +5,12 @@ import VTab from '../VTab'
5
5
  import {
6
6
  mount,
7
7
  RouterLinkStub,
8
- Wrapper,
8
+ VueWrapper,
9
9
  } from '@vue/test-utils'
10
10
 
11
- // Types
12
- import { ExtractVue } from './../../../util/mixins'
13
-
14
11
  describe('VTab.ts', () => {
15
- type Instance = ExtractVue<typeof VTab>
16
- let mountFunction: (options?: object) => Wrapper<Instance>
12
+ type Instance = InstanceType<typeof VTab>
13
+ let mountFunction: (options?: object) => VueWrapper<Instance>
17
14
 
18
15
  beforeEach(() => {
19
16
  mountFunction = (options = {}) => {
@@ -23,28 +20,33 @@ describe('VTab.ts', () => {
23
20
  }
24
21
  })
25
22
 
26
- it('should have the correct value', () => {
23
+ it('should have the correct value', async () => {
27
24
  const wrapper = mountFunction({
28
- propsData: {
25
+ props: {
29
26
  href: '#foo',
30
27
  },
31
- mocks: {
32
- $route: { path: '/' },
33
- $router: {
34
- resolve: to => {
35
- let href
36
- if (to.path) href = to.path
37
-
38
- return { href }
28
+ global: {
29
+ mocks: {
30
+ $route: { path: '/' },
31
+ $router: {
32
+ resolve: (to: any) => {
33
+ let href
34
+ if (to.path) href = to.path
35
+
36
+ return { href }
37
+ },
39
38
  },
40
39
  },
40
+ stubs: {
41
+ 'router-link': RouterLinkStub,
42
+ },
41
43
  },
42
44
  })
43
45
 
44
46
  expect(wrapper.vm.value).toBe('foo')
45
- wrapper.setProps({ href: null, to: '/foo' })
47
+ await wrapper.setProps({ href: null, to: '/foo' })
46
48
  expect(wrapper.vm.value).toBe('/foo')
47
- wrapper.setProps({ to: { path: 'bar' } })
49
+ await wrapper.setProps({ to: { path: 'bar' } })
48
50
  expect(wrapper.vm.value).toBe('bar')
49
51
  })
50
52
 
@@ -52,19 +54,23 @@ describe('VTab.ts', () => {
52
54
  it('should react to route change', async () => {
53
55
  const toggle = jest.fn()
54
56
  const wrapper = mountFunction({
55
- propsData: {
57
+ props: {
56
58
  activeClass: 'bar',
57
59
  to: 'foo',
58
60
  },
59
- methods: { toggle },
60
- mocks: {
61
- $route: { path: '/' },
62
- },
63
- stubs: {
64
- RouterLink: RouterLinkStub,
61
+ global: {
62
+ mocks: {
63
+ $route: { path: '/' },
64
+ },
65
+ stubs: {
66
+ 'router-link': RouterLinkStub,
67
+ },
65
68
  },
66
69
  })
67
70
 
71
+ // Mock the toggle method
72
+ wrapper.vm.toggle = toggle
73
+
68
74
  // Mock route change being called
69
75
  wrapper.vm.onRouteChange()
70
76
  await wrapper.vm.$nextTick()
@@ -73,15 +79,19 @@ describe('VTab.ts', () => {
73
79
 
74
80
  // explicitly mock class added
75
81
  // by vue router
76
- ;(wrapper.vm.$refs.link as any)._vnode.data = {
77
- class: { 'bar v-tab--active': true },
82
+ if (wrapper.vm.$refs.link) {
83
+ ;(wrapper.vm.$refs.link as any)._vnode = {
84
+ data: {
85
+ class: { 'bar v-tab--active': true },
86
+ }
87
+ }
78
88
  }
79
89
  ;(wrapper.vm as any).$route.path = '/foo'
80
90
 
81
91
  wrapper.vm.onRouteChange()
82
92
  await wrapper.vm.$nextTick()
83
93
 
84
- wrapper.setProps({ to: undefined })
94
+ await wrapper.setProps({ to: undefined })
85
95
 
86
96
  wrapper.vm.onRouteChange()
87
97
  await wrapper.vm.$nextTick()
@@ -89,26 +99,27 @@ describe('VTab.ts', () => {
89
99
  expect(toggle).toHaveBeenCalledTimes(1)
90
100
  })
91
101
 
92
- it('should respond to clicks and mousedown.enter', () => {
102
+ it('should respond to clicks and mousedown.enter', async () => {
93
103
  const event = { preventDefault: jest.fn() }
94
104
  const toggle = jest.fn()
95
- const wrapper = mountFunction({
96
- methods: { toggle },
97
- })
105
+ const wrapper = mountFunction()
106
+
107
+ // Mock the toggle method
108
+ wrapper.vm.toggle = toggle
98
109
 
99
- wrapper.trigger('click', event)
110
+ await wrapper.trigger('click', event)
100
111
 
101
112
  expect(event.preventDefault).not.toHaveBeenCalled()
102
113
  expect(toggle).toHaveBeenCalled()
103
114
 
104
- wrapper.setProps({ href: '#foo' })
115
+ await wrapper.setProps({ href: '#foo' })
105
116
 
106
- wrapper.trigger('click', event)
117
+ await wrapper.trigger('click', event)
107
118
 
108
119
  expect(event.preventDefault).toHaveBeenCalled()
109
120
 
110
- wrapper.trigger('keydown.enter', event)
111
- wrapper.trigger('keydown.space', event)
121
+ await wrapper.trigger('keydown.enter', event)
122
+ await wrapper.trigger('keydown.space', event)
112
123
 
113
124
  expect(event.preventDefault).toHaveBeenCalledTimes(2)
114
125
  expect(toggle).toHaveBeenCalledTimes(3)