@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.
- package/dist/vuetify.js +78 -22
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +1 -1
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VAlert/VAlert.js +0 -1
- package/es5/components/VAlert/VAlert.js.map +1 -1
- package/es5/components/VChip/VChip.js +1 -0
- package/es5/components/VChip/VChip.js.map +1 -1
- package/es5/components/VList/VListItem.js +4 -2
- package/es5/components/VList/VListItem.js.map +1 -1
- package/es5/components/VMenu/VMenu.js +1 -1
- package/es5/components/VMenu/VMenu.js.map +1 -1
- package/es5/components/VOtpInput/VOtpInput.js +36 -0
- package/es5/components/VOtpInput/VOtpInput.js.map +1 -1
- package/es5/components/VSelect/VSelectList.js +15 -2
- package/es5/components/VSelect/VSelectList.js.map +1 -1
- package/es5/components/VTooltip/VTooltip.js +3 -3
- package/es5/components/VTooltip/VTooltip.js.map +1 -1
- package/es5/components/VTreeview/VTreeview.js +0 -7
- package/es5/components/VTreeview/VTreeview.js.map +1 -1
- package/es5/framework.js +1 -1
- package/es5/mixins/routable/index.js +5 -2
- package/es5/mixins/routable/index.js.map +1 -1
- package/lib/components/VAlert/VAlert.js +0 -1
- package/lib/components/VAlert/VAlert.js.map +1 -1
- package/lib/components/VChip/VChip.js +1 -0
- package/lib/components/VChip/VChip.js.map +1 -1
- package/lib/components/VList/VListItem.js +4 -2
- package/lib/components/VList/VListItem.js.map +1 -1
- package/lib/components/VMenu/VMenu.js +1 -1
- package/lib/components/VMenu/VMenu.js.map +1 -1
- package/lib/components/VOtpInput/VOtpInput.js +48 -0
- package/lib/components/VOtpInput/VOtpInput.js.map +1 -1
- package/lib/components/VSelect/VSelectList.js +11 -5
- package/lib/components/VSelect/VSelectList.js.map +1 -1
- package/lib/components/VTooltip/VTooltip.js +3 -3
- package/lib/components/VTooltip/VTooltip.js.map +1 -1
- package/lib/components/VTreeview/VTreeview.js +0 -6
- package/lib/components/VTreeview/VTreeview.js.map +1 -1
- package/lib/framework.js +1 -1
- package/lib/mixins/routable/index.js +5 -2
- package/lib/mixins/routable/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/VAlert/VAlert.ts +0 -1
- package/src/components/VApp/__tests__/VApp.spec.ts +24 -18
- package/src/components/VApp/__tests__/__snapshots__/VApp.spec.ts.snap +4 -4
- package/src/components/VAppBar/__tests__/VAppBar.spec.ts +256 -74
- package/src/components/VAppBar/__tests__/VAppBarNavIcon.spec.ts +2 -6
- package/src/components/VAppBar/__tests__/__snapshots__/VAppBar.spec.ts.snap +13 -4
- package/src/components/VAppBar/__tests__/__snapshots__/VAppBarNavIcon.spec.ts.snap +3 -4
- package/src/components/VBanner/__tests__/VBanner.spec.ts +35 -36
- package/src/components/VBanner/__tests__/__snapshots__/VBanner.spec.ts.snap +1 -1
- package/src/components/VBtn/__tests__/VBtn.spec.ts +1 -1
- package/src/components/VCard/__tests__/VCard.spec.ts +46 -28
- package/src/components/VCard/__tests__/__snapshots__/VCard.spec.ts.snap +2 -2
- package/src/components/VCheckbox/__tests__/VCheckbox.spec.ts +157 -152
- package/src/components/VChip/VChip.ts +1 -0
- package/src/components/VChip/__tests__/VChip.spec.ts +50 -50
- package/src/components/VChip/__tests__/__snapshots__/VChip.spec.ts.snap +4 -4
- package/src/components/VChipGroup/__tests__/VChipGroup.spec.ts +14 -21
- package/src/components/VColorPicker/__tests__/__snapshots__/VColorPicker.spec.ts.snap +35 -35
- package/src/components/VColorPicker/__tests__/__snapshots__/VColorPickerEdit.spec.ts.snap +10 -10
- package/src/components/VData/__tests__/VData.spec.ts +69 -90
- package/src/components/VDataTable/__tests__/MobileRow.spec.ts +55 -66
- package/src/components/VDataTable/__tests__/Row.spec.ts +64 -73
- package/src/components/VDataTable/__tests__/RowGroup.spec.ts +7 -5
- package/src/components/VDataTable/__tests__/VDataTable.spec.ts +910 -988
- package/src/components/VDataTable/__tests__/VEditDialog.spec.ts +26 -22
- package/src/components/VDataTable/__tests__/VSimpleTable.spec.ts +60 -29
- package/src/components/VDataTable/__tests__/VVirtualTable.spec.ts +13 -15
- package/src/components/VDataTable/__tests__/__snapshots__/Row.spec.ts.snap +30 -0
- package/src/components/VDataTable/__tests__/__snapshots__/VEditDialog.spec.ts.snap +18 -10
- package/src/components/VDataTable/mixins/__tests__/__snapshots__/header.spec.ts.snap +1 -1
- package/src/components/VDivider/__tests__/VDivider.spec.ts +11 -15
- package/src/components/VDivider/__tests__/__snapshots__/VDivider.spec.ts.snap +2 -2
- package/src/components/VGrid/__tests__/VCol.spec.ts +17 -17
- package/src/components/VGrid/__tests__/VContainer.spec.ts +58 -3
- package/src/components/VGrid/__tests__/VFlex.spec.ts +3 -3
- package/src/components/VGrid/__tests__/VGrid.spec.ts +12 -10
- package/src/components/VGrid/__tests__/VLayout.spec.ts +3 -3
- package/src/components/VIcon/__tests__/VIcon.spec.ts +176 -70
- package/src/components/VImg/__tests__/__snapshots__/VImg.spec.ts.snap +55 -55
- package/src/components/VItemGroup/__tests__/VItem.spec.ts +22 -37
- package/src/components/VItemGroup/__tests__/VItemGroup.spec.ts +96 -124
- package/src/components/VItemGroup/__tests__/__snapshots__/VItem.spec.ts.snap +2 -0
- package/src/components/VLabel/__tests__/VLabel.spec.ts +240 -14
- package/src/components/VLazy/__tests__/VLazy.spec.ts +5 -4
- package/src/components/VLazy/__tests__/__snapshots__/VLazy.spec.ts.snap +2 -1
- package/src/components/VList/VListItem.ts +9 -3
- package/src/components/VList/__tests__/VList.spec.ts +13 -12
- package/src/components/VList/__tests__/VListGroup.spec.ts +59 -51
- package/src/components/VList/__tests__/VListItem.spec.ts +142 -63
- package/src/components/VList/__tests__/VListItemAvatar.spec.ts +5 -2
- package/src/components/VList/__tests__/VListItemGroup.spec.ts +5 -2
- package/src/components/VList/__tests__/__snapshots__/VList.spec.ts.snap +10 -10
- package/src/components/VList/__tests__/__snapshots__/VListGroup.spec.ts.snap +5 -6
- package/src/components/VList/__tests__/__snapshots__/VListItem.spec.ts.snap +1 -1
- package/src/components/VMain/__tests__/VMain.spec.ts +71 -17
- package/src/components/VMenu/VMenu.ts +1 -1
- package/src/components/VMessages/__tests__/VMessages.spec.ts +14 -13
- package/src/components/VOtpInput/VOtpInput.ts +37 -1
- package/src/components/VParallax/__tests__/__snapshots__/VParallax.spec.ts.snap +8 -8
- package/src/components/VPicker/__tests__/__snapshots__/VPicker.spec.ts.snap +2 -2
- package/src/components/VResponsive/__tests__/__snapshots__/VResponsive.spec.ts.snap +2 -2
- package/src/components/VSelect/VSelectList.ts +9 -9
- package/src/components/VSelect/__tests__/VSelect.spec.ts +166 -125
- package/src/components/VSelect/__tests__/VSelect2.spec.ts +127 -111
- package/src/components/VSelect/__tests__/VSelect3.spec.ts +109 -91
- package/src/components/VSelect/__tests__/VSelect4.spec.ts +79 -68
- package/src/components/VSelect/__tests__/VSelectList.spec.ts +23 -31
- package/src/components/VSelect/__tests__/__snapshots__/VSelect.spec.ts.snap +58 -62
- package/src/components/VSelect/__tests__/__snapshots__/VSelect2.spec.ts.snap +50 -62
- package/src/components/VSelect/__tests__/__snapshots__/VSelect3.spec.ts.snap +10 -14
- package/src/components/VSparkline/__tests__/VSparkline.spec.ts +33 -35
- package/src/components/VStepper/__tests__/VStepper.spec.ts +4 -1
- package/src/components/VStepper/__tests__/VStepperContent.spec.ts +104 -110
- package/src/components/VStepper/__tests__/VStepperStep.spec.ts +51 -44
- package/src/components/VSwitch/__tests__/VSwitch.spec.ts +30 -37
- package/src/components/VTabs/__tests__/VTabs.spec.ts +0 -7
- package/src/components/VTextField/__tests__/VTextField.spec.ts +342 -246
- package/src/components/VTextarea/__tests__/VTextarea.spec.ts +112 -35
- package/src/components/VTimePicker/__tests__/__snapshots__/VTimePicker.spec.ts.snap +0 -40
- package/src/components/VToolbar/__tests__/VToolbar.spec.ts +49 -25
- package/src/components/VTooltip/VTooltip.ts +3 -3
- package/src/components/VTooltip/__tests__/__snapshots__/VTooltip.spec.ts.snap +34 -18
- package/src/components/VTreeview/VTreeview.ts +0 -5
- package/src/mixins/routable/index.ts +6 -4
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import VData from '../VData'
|
|
2
|
+
import { h } from 'vue'
|
|
2
3
|
import {
|
|
3
4
|
mount,
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
MountingOptions,
|
|
6
|
+
VueWrapper,
|
|
6
7
|
} from '@vue/test-utils'
|
|
7
8
|
|
|
8
9
|
describe('VData.ts', () => {
|
|
9
10
|
type Instance = InstanceType<typeof VData>
|
|
10
|
-
let mountFunction: (options?:
|
|
11
|
+
let mountFunction: (options?: any) => VueWrapper<Instance>
|
|
11
12
|
beforeEach(() => {
|
|
12
|
-
mountFunction = (options?:
|
|
13
|
+
mountFunction = (options?: any) => {
|
|
13
14
|
return mount(VData, {
|
|
14
15
|
...options,
|
|
15
|
-
sync: false,
|
|
16
16
|
})
|
|
17
17
|
}
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
it('should render data through default scoped slot', async () => {
|
|
21
21
|
const wrapper = mountFunction({
|
|
22
|
-
|
|
22
|
+
props: {
|
|
23
23
|
items: [
|
|
24
24
|
{ id: 1, text: 'foo' },
|
|
25
25
|
{ id: 2, text: 'bar' },
|
|
26
26
|
],
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
default (data)
|
|
30
|
-
return h('div', data.items.map(item => h('div', [item.text])))
|
|
31
|
-
},
|
|
28
|
+
slots: {
|
|
29
|
+
default: (data: any) => h('div', data.items.map((item: any) => h('div', [item.text]))),
|
|
32
30
|
},
|
|
33
31
|
})
|
|
34
32
|
|
|
@@ -40,13 +38,13 @@ describe('VData.ts', () => {
|
|
|
40
38
|
it('should ignore items length if using server-items-length', async () => {
|
|
41
39
|
const render = jest.fn()
|
|
42
40
|
const wrapper = mountFunction({
|
|
43
|
-
|
|
41
|
+
props: {
|
|
44
42
|
items: [
|
|
45
43
|
{ id: 1, text: 'foo' },
|
|
46
44
|
{ id: 2, text: 'bar' },
|
|
47
45
|
],
|
|
48
46
|
},
|
|
49
|
-
|
|
47
|
+
slots: {
|
|
50
48
|
default: render,
|
|
51
49
|
},
|
|
52
50
|
})
|
|
@@ -58,7 +56,7 @@ describe('VData.ts', () => {
|
|
|
58
56
|
}),
|
|
59
57
|
}))
|
|
60
58
|
|
|
61
|
-
wrapper.setProps({
|
|
59
|
+
await wrapper.setProps({
|
|
62
60
|
serverItemsLength: 10,
|
|
63
61
|
})
|
|
64
62
|
|
|
@@ -79,11 +77,11 @@ describe('VData.ts', () => {
|
|
|
79
77
|
]
|
|
80
78
|
|
|
81
79
|
const wrapper = mountFunction({
|
|
82
|
-
|
|
80
|
+
props: {
|
|
83
81
|
items,
|
|
84
82
|
groupBy: ['baz'],
|
|
85
83
|
},
|
|
86
|
-
|
|
84
|
+
slots: {
|
|
87
85
|
default: render,
|
|
88
86
|
},
|
|
89
87
|
})
|
|
@@ -111,11 +109,11 @@ describe('VData.ts', () => {
|
|
|
111
109
|
]
|
|
112
110
|
|
|
113
111
|
const wrapper = mountFunction({
|
|
114
|
-
|
|
112
|
+
props: {
|
|
115
113
|
items,
|
|
116
114
|
groupBy: ['baz'],
|
|
117
115
|
},
|
|
118
|
-
|
|
116
|
+
slots: {
|
|
119
117
|
default: render,
|
|
120
118
|
},
|
|
121
119
|
})
|
|
@@ -143,11 +141,11 @@ describe('VData.ts', () => {
|
|
|
143
141
|
]
|
|
144
142
|
|
|
145
143
|
const wrapper = mountFunction({
|
|
146
|
-
|
|
144
|
+
props: {
|
|
147
145
|
items,
|
|
148
146
|
groupBy: ['foo.bar'],
|
|
149
147
|
},
|
|
150
|
-
|
|
148
|
+
slots: {
|
|
151
149
|
default: render,
|
|
152
150
|
},
|
|
153
151
|
})
|
|
@@ -175,7 +173,7 @@ describe('VData.ts', () => {
|
|
|
175
173
|
]
|
|
176
174
|
|
|
177
175
|
const wrapper = mountFunction({
|
|
178
|
-
|
|
176
|
+
props: {
|
|
179
177
|
items,
|
|
180
178
|
groupBy: ['value'],
|
|
181
179
|
customGroup: function evenOddGrouper (items: any[], groupBy: string[]) {
|
|
@@ -187,7 +185,7 @@ describe('VData.ts', () => {
|
|
|
187
185
|
}, {})
|
|
188
186
|
},
|
|
189
187
|
},
|
|
190
|
-
|
|
188
|
+
slots: {
|
|
191
189
|
default: render,
|
|
192
190
|
},
|
|
193
191
|
})
|
|
@@ -218,11 +216,11 @@ describe('VData.ts', () => {
|
|
|
218
216
|
]
|
|
219
217
|
|
|
220
218
|
const wrapper = mountFunction({
|
|
221
|
-
|
|
219
|
+
props: {
|
|
222
220
|
items: unsorted,
|
|
223
221
|
sortBy: ['text'],
|
|
224
222
|
},
|
|
225
|
-
|
|
223
|
+
slots: {
|
|
226
224
|
default: render,
|
|
227
225
|
},
|
|
228
226
|
})
|
|
@@ -250,18 +248,18 @@ describe('VData.ts', () => {
|
|
|
250
248
|
]
|
|
251
249
|
|
|
252
250
|
const wrapper = mountFunction({
|
|
253
|
-
|
|
251
|
+
props: {
|
|
254
252
|
items: unsorted,
|
|
255
253
|
sortBy: ['foo'],
|
|
256
254
|
},
|
|
257
|
-
|
|
255
|
+
slots: {
|
|
258
256
|
default: render,
|
|
259
257
|
},
|
|
260
258
|
})
|
|
261
259
|
|
|
262
260
|
await wrapper.vm.$nextTick()
|
|
263
261
|
|
|
264
|
-
wrapper.setProps({
|
|
262
|
+
await wrapper.setProps({
|
|
265
263
|
sortBy: ['foo', 'bar'],
|
|
266
264
|
})
|
|
267
265
|
await wrapper.vm.$nextTick()
|
|
@@ -288,12 +286,12 @@ describe('VData.ts', () => {
|
|
|
288
286
|
]
|
|
289
287
|
|
|
290
288
|
const wrapper = mountFunction({
|
|
291
|
-
|
|
289
|
+
props: {
|
|
292
290
|
items,
|
|
293
291
|
itemsPerPage: 5,
|
|
294
292
|
page: 2,
|
|
295
293
|
},
|
|
296
|
-
|
|
294
|
+
slots: {
|
|
297
295
|
default: render,
|
|
298
296
|
},
|
|
299
297
|
})
|
|
@@ -315,12 +313,12 @@ describe('VData.ts', () => {
|
|
|
315
313
|
]
|
|
316
314
|
|
|
317
315
|
const wrapper = mountFunction({
|
|
318
|
-
|
|
316
|
+
props: {
|
|
319
317
|
items,
|
|
320
318
|
sortBy: ['text'],
|
|
321
319
|
disableSort: true,
|
|
322
320
|
},
|
|
323
|
-
|
|
321
|
+
slots: {
|
|
324
322
|
default: render,
|
|
325
323
|
},
|
|
326
324
|
})
|
|
@@ -341,8 +339,8 @@ describe('VData.ts', () => {
|
|
|
341
339
|
]
|
|
342
340
|
|
|
343
341
|
const wrapper = mountFunction({
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
props: { items },
|
|
343
|
+
slots: {
|
|
346
344
|
default: render,
|
|
347
345
|
},
|
|
348
346
|
})
|
|
@@ -351,14 +349,14 @@ describe('VData.ts', () => {
|
|
|
351
349
|
items,
|
|
352
350
|
}))
|
|
353
351
|
|
|
354
|
-
wrapper.setProps({ itemsPerPage: 2 })
|
|
352
|
+
await wrapper.setProps({ itemsPerPage: 2 })
|
|
355
353
|
await wrapper.vm.$nextTick()
|
|
356
354
|
|
|
357
355
|
expect(render).toHaveBeenCalledWith(expect.objectContaining({
|
|
358
356
|
items: items.slice(0, 2),
|
|
359
357
|
}))
|
|
360
358
|
|
|
361
|
-
wrapper.setProps({ disablePagination: true })
|
|
359
|
+
await wrapper.setProps({ disablePagination: true })
|
|
362
360
|
await wrapper.vm.$nextTick()
|
|
363
361
|
|
|
364
362
|
expect(render).toHaveBeenCalledWith(expect.objectContaining({
|
|
@@ -375,19 +373,15 @@ describe('VData.ts', () => {
|
|
|
375
373
|
]
|
|
376
374
|
|
|
377
375
|
const wrapper = mountFunction({
|
|
378
|
-
|
|
376
|
+
props: {
|
|
379
377
|
items: unsorted,
|
|
380
378
|
},
|
|
381
|
-
|
|
382
|
-
default (props) {
|
|
383
|
-
const items = props.items.map(item => h('div', [item.text]))
|
|
379
|
+
slots: {
|
|
380
|
+
default: (props: any) => {
|
|
381
|
+
const items = props.items.map((item: any) => h('div', [item.text]))
|
|
384
382
|
return h('div', {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
},
|
|
388
|
-
on: {
|
|
389
|
-
click: () => props.sort('text'),
|
|
390
|
-
},
|
|
383
|
+
id: 'wrapper',
|
|
384
|
+
onClick: () => props.sort('text'),
|
|
391
385
|
}, items)
|
|
392
386
|
},
|
|
393
387
|
},
|
|
@@ -395,13 +389,12 @@ describe('VData.ts', () => {
|
|
|
395
389
|
|
|
396
390
|
expect(wrapper.html()).toMatchSnapshot()
|
|
397
391
|
|
|
398
|
-
|
|
399
|
-
el.click()
|
|
392
|
+
await wrapper.find('#wrapper').trigger('click')
|
|
400
393
|
await wrapper.vm.$nextTick()
|
|
401
394
|
|
|
402
395
|
expect(wrapper.html()).toMatchSnapshot()
|
|
403
396
|
|
|
404
|
-
|
|
397
|
+
await wrapper.find('#wrapper').trigger('click')
|
|
405
398
|
await wrapper.vm.$nextTick()
|
|
406
399
|
expect(wrapper.html()).toMatchSnapshot()
|
|
407
400
|
})
|
|
@@ -415,19 +408,15 @@ describe('VData.ts', () => {
|
|
|
415
408
|
]
|
|
416
409
|
|
|
417
410
|
const wrapper = mountFunction({
|
|
418
|
-
|
|
411
|
+
props: {
|
|
419
412
|
items: unsorted,
|
|
420
413
|
},
|
|
421
|
-
|
|
422
|
-
default (props) {
|
|
423
|
-
const items = props.items.map(item => h('div', [`${item.group}-${item.text}`]))
|
|
414
|
+
slots: {
|
|
415
|
+
default: (props: any) => {
|
|
416
|
+
const items = props.items.map((item: any) => h('div', [`${item.group}-${item.text}`]))
|
|
424
417
|
return h('div', {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
},
|
|
428
|
-
on: {
|
|
429
|
-
click: () => props.sort(['group', 'text']),
|
|
430
|
-
},
|
|
418
|
+
id: 'wrapper',
|
|
419
|
+
onClick: () => props.sort(['group', 'text']),
|
|
431
420
|
}, items)
|
|
432
421
|
},
|
|
433
422
|
},
|
|
@@ -435,8 +424,7 @@ describe('VData.ts', () => {
|
|
|
435
424
|
|
|
436
425
|
expect(wrapper.html()).toMatchSnapshot()
|
|
437
426
|
|
|
438
|
-
|
|
439
|
-
el.click()
|
|
427
|
+
await wrapper.find('#wrapper').trigger('click')
|
|
440
428
|
await wrapper.vm.$nextTick()
|
|
441
429
|
|
|
442
430
|
expect(wrapper.html()).toMatchSnapshot()
|
|
@@ -451,31 +439,26 @@ describe('VData.ts', () => {
|
|
|
451
439
|
]
|
|
452
440
|
|
|
453
441
|
const wrapper = mountFunction({
|
|
454
|
-
|
|
442
|
+
props: {
|
|
455
443
|
items: unsorted,
|
|
456
444
|
},
|
|
457
|
-
|
|
458
|
-
default (props) {
|
|
445
|
+
slots: {
|
|
446
|
+
default: (props: any) => {
|
|
459
447
|
const items = props.groupedItems
|
|
460
|
-
? props.groupedItems.map(group => group.name)
|
|
461
|
-
: props.items.map(item => item.text)
|
|
448
|
+
? props.groupedItems.map((group: any) => group.name)
|
|
449
|
+
: props.items.map((item: any) => item.text)
|
|
462
450
|
|
|
463
451
|
return h('div', {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
on: {
|
|
468
|
-
click: () => props.group('group'),
|
|
469
|
-
},
|
|
470
|
-
}, items.map(item => h('div', [item])))
|
|
452
|
+
id: 'wrapper',
|
|
453
|
+
onClick: () => props.group('group'),
|
|
454
|
+
}, items.map((item: any) => h('div', [item])))
|
|
471
455
|
},
|
|
472
456
|
},
|
|
473
457
|
})
|
|
474
458
|
|
|
475
459
|
expect(wrapper.html()).toMatchSnapshot()
|
|
476
460
|
|
|
477
|
-
|
|
478
|
-
el.click()
|
|
461
|
+
await wrapper.find('#wrapper').trigger('click')
|
|
479
462
|
await wrapper.vm.$nextTick()
|
|
480
463
|
|
|
481
464
|
expect(wrapper.html()).toMatchSnapshot()
|
|
@@ -485,14 +468,14 @@ describe('VData.ts', () => {
|
|
|
485
468
|
it('should handle setting itemsPerPage to zero', async () => {
|
|
486
469
|
const render = jest.fn()
|
|
487
470
|
const wrapper = mountFunction({
|
|
488
|
-
|
|
471
|
+
props: {
|
|
489
472
|
items: [
|
|
490
473
|
{ id: 1, text: 'foo' },
|
|
491
474
|
{ id: 2, text: 'bar' },
|
|
492
475
|
],
|
|
493
476
|
itemsPerPage: 0,
|
|
494
477
|
},
|
|
495
|
-
|
|
478
|
+
slots: {
|
|
496
479
|
default: render,
|
|
497
480
|
},
|
|
498
481
|
})
|
|
@@ -508,7 +491,7 @@ describe('VData.ts', () => {
|
|
|
508
491
|
}),
|
|
509
492
|
}))
|
|
510
493
|
|
|
511
|
-
wrapper.setProps({
|
|
494
|
+
await wrapper.setProps({
|
|
512
495
|
itemsPerPage: 1,
|
|
513
496
|
})
|
|
514
497
|
|
|
@@ -534,30 +517,26 @@ describe('VData.ts', () => {
|
|
|
534
517
|
]
|
|
535
518
|
|
|
536
519
|
const wrapper = mountFunction({
|
|
537
|
-
|
|
520
|
+
props: {
|
|
538
521
|
items: unsorted,
|
|
539
522
|
groupBy: ['text'],
|
|
540
523
|
},
|
|
541
|
-
|
|
542
|
-
default (props) {
|
|
524
|
+
slots: {
|
|
525
|
+
default: (props: any) => {
|
|
543
526
|
return h('div', {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
on: {
|
|
548
|
-
click: () => props.group('group'),
|
|
549
|
-
},
|
|
550
|
-
}, props.groupedItems.map(group => h('div', [group.name])))
|
|
527
|
+
id: 'wrapper',
|
|
528
|
+
onClick: () => props.group('group'),
|
|
529
|
+
}, props.groupedItems.map((group: any) => h('div', [group.name])))
|
|
551
530
|
},
|
|
552
531
|
},
|
|
553
532
|
})
|
|
554
533
|
|
|
555
|
-
wrapper.setProps({ groupDesc: [false] })
|
|
534
|
+
await wrapper.setProps({ groupDesc: [false] })
|
|
556
535
|
await wrapper.vm.$nextTick()
|
|
557
536
|
|
|
558
537
|
expect(wrapper.html()).toMatchSnapshot()
|
|
559
538
|
|
|
560
|
-
wrapper.setProps({ groupDesc: [true] })
|
|
539
|
+
await wrapper.setProps({ groupDesc: [true] })
|
|
561
540
|
await wrapper.vm.$nextTick()
|
|
562
541
|
|
|
563
542
|
expect(wrapper.html()).toMatchSnapshot()
|
|
@@ -573,12 +552,12 @@ describe('VData.ts', () => {
|
|
|
573
552
|
]
|
|
574
553
|
|
|
575
554
|
const wrapper = mountFunction({
|
|
576
|
-
|
|
555
|
+
props: {
|
|
577
556
|
items,
|
|
578
557
|
groupBy: ['baz'],
|
|
579
558
|
disableSort: true,
|
|
580
559
|
},
|
|
581
|
-
|
|
560
|
+
slots: {
|
|
582
561
|
default: render,
|
|
583
562
|
},
|
|
584
563
|
})
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
import MobileRow from '../MobileRow'
|
|
2
2
|
import {
|
|
3
3
|
mount,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
VueWrapper,
|
|
5
|
+
MountingOptions,
|
|
6
6
|
} from '@vue/test-utils'
|
|
7
|
-
import
|
|
7
|
+
import { h } from 'vue'
|
|
8
8
|
|
|
9
9
|
describe('MobileRow', () => {
|
|
10
10
|
type Instance = InstanceType<typeof MobileRow>
|
|
11
|
-
let mountFunction: (options?:
|
|
11
|
+
let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
|
|
12
12
|
beforeEach(() => {
|
|
13
|
-
mountFunction = (options?:
|
|
13
|
+
mountFunction = (options?: MountingOptions<Instance>) => {
|
|
14
14
|
return mount(MobileRow, options)
|
|
15
15
|
}
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
it('should render without slots', () => {
|
|
19
19
|
const wrapper = mountFunction({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
diesel: 0.65,
|
|
29
|
-
},
|
|
20
|
+
props: {
|
|
21
|
+
headers: [
|
|
22
|
+
{ text: 'Petrol', value: 'petrol' },
|
|
23
|
+
{ text: 'Diesel', value: 'diesel' },
|
|
24
|
+
],
|
|
25
|
+
item: {
|
|
26
|
+
petrol: 0.68,
|
|
27
|
+
diesel: 0.65,
|
|
30
28
|
},
|
|
31
29
|
},
|
|
32
30
|
})
|
|
@@ -38,25 +36,23 @@ describe('MobileRow', () => {
|
|
|
38
36
|
|
|
39
37
|
it('should render non-string values', () => {
|
|
40
38
|
const wrapper = mountFunction({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
null: null,
|
|
59
|
-
},
|
|
39
|
+
props: {
|
|
40
|
+
headers: [
|
|
41
|
+
{ value: 'string' },
|
|
42
|
+
{ value: 'number' },
|
|
43
|
+
{ value: 'array' },
|
|
44
|
+
{ value: 'boolean' },
|
|
45
|
+
{ value: 'object' },
|
|
46
|
+
{ value: 'undefined' },
|
|
47
|
+
{ value: 'null' },
|
|
48
|
+
],
|
|
49
|
+
item: {
|
|
50
|
+
string: 'string',
|
|
51
|
+
number: 12.34,
|
|
52
|
+
array: [1, 2],
|
|
53
|
+
boolean: false,
|
|
54
|
+
object: { foo: 'bar' },
|
|
55
|
+
null: null,
|
|
60
56
|
},
|
|
61
57
|
},
|
|
62
58
|
})
|
|
@@ -66,13 +62,11 @@ describe('MobileRow', () => {
|
|
|
66
62
|
|
|
67
63
|
it('should render with regular slots', () => {
|
|
68
64
|
const wrapper = mountFunction({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
],
|
|
75
|
-
},
|
|
65
|
+
props: {
|
|
66
|
+
headers: [
|
|
67
|
+
{ text: 'Petrol', value: 'petrol' },
|
|
68
|
+
{ text: 'Diesel', value: 'diesel' },
|
|
69
|
+
],
|
|
76
70
|
},
|
|
77
71
|
slots: {
|
|
78
72
|
petrol: '<p class="test">$0.68</p>',
|
|
@@ -87,23 +81,20 @@ describe('MobileRow', () => {
|
|
|
87
81
|
})
|
|
88
82
|
|
|
89
83
|
it('should render with scoped slots', () => {
|
|
90
|
-
const vm = new Vue()
|
|
91
84
|
const wrapper = mountFunction({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
diesel: 0.65,
|
|
101
|
-
},
|
|
85
|
+
props: {
|
|
86
|
+
headers: [
|
|
87
|
+
{ text: 'Petrol', value: 'petrol' },
|
|
88
|
+
{ text: 'Diesel', value: 'diesel' },
|
|
89
|
+
],
|
|
90
|
+
item: {
|
|
91
|
+
petrol: 0.68,
|
|
92
|
+
diesel: 0.65,
|
|
102
93
|
},
|
|
103
94
|
},
|
|
104
|
-
|
|
105
|
-
petrol: props =>
|
|
106
|
-
diesel: props =>
|
|
95
|
+
slots: {
|
|
96
|
+
petrol: (props: any) => h('p', { class: `test ${props.header.value}` }, [props.value]),
|
|
97
|
+
diesel: (props: any) => h('p', { class: `test ${props.header.value}` }, [props.value]),
|
|
107
98
|
},
|
|
108
99
|
})
|
|
109
100
|
|
|
@@ -115,17 +106,15 @@ describe('MobileRow', () => {
|
|
|
115
106
|
|
|
116
107
|
it('should render without header when hideDefaultHeader: true', () => {
|
|
117
108
|
const wrapper = mountFunction({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
diesel: 0.65,
|
|
128
|
-
},
|
|
109
|
+
props: {
|
|
110
|
+
headers: [
|
|
111
|
+
{ text: 'Petrol', value: 'petrol' },
|
|
112
|
+
{ text: 'Diesel', value: 'diesel' },
|
|
113
|
+
],
|
|
114
|
+
hideDefaultHeader: true,
|
|
115
|
+
item: {
|
|
116
|
+
petrol: 0.68,
|
|
117
|
+
diesel: 0.65,
|
|
129
118
|
},
|
|
130
119
|
},
|
|
131
120
|
})
|