@dimailn/vuetify 2.7.2-alpha21 → 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.
- package/dist/vuetify.js +89 -40
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +1 -1
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VOverlay/VOverlay.js +2 -3
- package/es5/components/VOverlay/VOverlay.js.map +1 -1
- package/es5/components/VProgressCircular/VProgressCircular.js +5 -3
- package/es5/components/VProgressCircular/VProgressCircular.js.map +1 -1
- package/es5/components/VProgressLinear/VProgressLinear.js +41 -19
- package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/es5/components/VTabs/VTabsBar.js.map +1 -1
- package/es5/components/VVirtualScroll/VVirtualScroll.js +15 -16
- package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
- package/es5/components/VWindow/VWindow.js +13 -5
- package/es5/components/VWindow/VWindow.js.map +1 -1
- package/es5/components/VWindow/VWindowItem.js +9 -5
- package/es5/components/VWindow/VWindowItem.js.map +1 -1
- package/es5/framework.js +1 -1
- package/es5/mixins/overlayable/index.js.map +1 -1
- package/lib/components/VOverlay/VOverlay.js +1 -2
- package/lib/components/VOverlay/VOverlay.js.map +1 -1
- package/lib/components/VProgressCircular/VProgressCircular.js +5 -3
- package/lib/components/VProgressCircular/VProgressCircular.js.map +1 -1
- package/lib/components/VProgressLinear/VProgressLinear.js +35 -17
- package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/lib/components/VTabs/VTabsBar.js.map +1 -1
- package/lib/components/VVirtualScroll/VVirtualScroll.js +8 -11
- package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
- package/lib/components/VWindow/VWindow.js +7 -3
- package/lib/components/VWindow/VWindow.js.map +1 -1
- package/lib/components/VWindow/VWindowItem.js +3 -1
- package/lib/components/VWindow/VWindowItem.js.map +1 -1
- package/lib/framework.js +1 -1
- package/lib/mixins/overlayable/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/VAvatar/__tests__/VAvatar.spec.ts +72 -10
- package/src/components/VOverlay/VOverlay.ts +1 -1
- package/src/components/VOverlay/__tests__/VOverlay.spec.ts +6 -6
- package/src/components/VProgressCircular/VProgressCircular.ts +6 -5
- package/src/components/VProgressCircular/__tests__/VProgressCircular.spec.ts +28 -21
- package/src/components/VProgressCircular/__tests__/__snapshots__/VProgressCircular.spec.ts.snap +62 -62
- package/src/components/VProgressLinear/VProgressLinear.ts +42 -22
- package/src/components/VProgressLinear/__tests__/VProgressLinear.spec.ts +378 -71
- package/src/components/VProgressLinear/__tests__/__snapshots__/VProgressLinear.spec.ts.snap +53 -79
- package/src/components/VSheet/__tests__/VSheet.spec.ts +5 -5
- package/src/components/VTabs/VTabsBar.ts +7 -5
- package/src/components/VVirtualScroll/VVirtualScroll.ts +14 -13
- package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +26 -19
- package/src/components/VWindow/VWindow.ts +9 -5
- package/src/components/VWindow/VWindowItem.ts +3 -1
- package/src/components/VWindow/__tests__/VWindow.spec.ts +226 -185
- package/src/components/VWindow/__tests__/VWindowItem.spec.ts +162 -132
- package/src/mixins/applicationable/__tests__/applicationable.spec.ts +31 -27
- package/src/mixins/colorable/__tests__/colorable.spec.ts +9 -6
- package/src/mixins/elevatable/__tests__/elevatable.spec.ts +14 -13
- package/src/mixins/intersectable/__tests__/intersectable.spec.ts +35 -29
- package/src/mixins/menuable/__tests__/menuable.spec.ts +76 -33
- package/src/mixins/mobile/__tests__/mobile.spec.ts +9 -6
- package/src/mixins/overlayable/__tests__/overlayable.spec.ts +32 -24
- package/src/mixins/overlayable/index.ts +1 -1
- package/src/mixins/proxyable/__tests__/proxyable.spec.ts +18 -17
- package/src/mixins/registrable/__tests__/registrable.spec.ts +31 -0
- package/src/mixins/rippleable/__tests__/rippleable.spec.ts +10 -9
- package/src/mixins/roundable/__tests__/roundable.spec.ts +7 -5
- package/src/mixins/routable/__tests__/routable.spec.ts +60 -52
- package/src/mixins/scrollable/__tests__/scrollable.spec.ts +56 -27
- package/src/mixins/selectable/__tests__/selectable.spec.ts +22 -9
|
@@ -5,26 +5,41 @@ import VWindowItem from '../VWindowItem'
|
|
|
5
5
|
// Utilities
|
|
6
6
|
import {
|
|
7
7
|
mount,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
MountingOptions,
|
|
9
|
+
VueWrapper,
|
|
10
|
+
enableAutoUnmount,
|
|
10
11
|
} from '@vue/test-utils'
|
|
12
|
+
import { h, nextTick } from 'vue'
|
|
11
13
|
import { touch } from '../../../../test'
|
|
12
14
|
|
|
13
15
|
describe('VWindow.ts', () => {
|
|
14
|
-
type Instance = InstanceType<typeof VWindow
|
|
15
|
-
let mountFunction: (
|
|
16
|
+
type Instance = InstanceType<typeof VWindow>;
|
|
17
|
+
let mountFunction: (
|
|
18
|
+
options?: MountingOptions<Instance>
|
|
19
|
+
) => VueWrapper<Instance>
|
|
20
|
+
|
|
21
|
+
enableAutoUnmount(afterEach)
|
|
16
22
|
|
|
17
23
|
beforeEach(() => {
|
|
18
24
|
mountFunction = (options = {}) => {
|
|
19
25
|
return mount(VWindow, {
|
|
20
26
|
...options,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
global: {
|
|
28
|
+
config: {
|
|
29
|
+
warnHandler: () => {}, // Подавляем предупреждения Vue
|
|
30
|
+
},
|
|
31
|
+
mocks: {
|
|
32
|
+
$vuetify: {
|
|
33
|
+
lang: {
|
|
34
|
+
t: (str: string) => str,
|
|
35
|
+
},
|
|
36
|
+
rtl: false,
|
|
37
|
+
icons: {
|
|
38
|
+
component: false,
|
|
39
|
+
},
|
|
25
40
|
},
|
|
26
|
-
rtl: false,
|
|
27
41
|
},
|
|
42
|
+
...options.global,
|
|
28
43
|
},
|
|
29
44
|
})
|
|
30
45
|
}
|
|
@@ -32,161 +47,194 @@ describe('VWindow.ts', () => {
|
|
|
32
47
|
|
|
33
48
|
it('should return the correct transition', async () => {
|
|
34
49
|
const wrapper = mountFunction()
|
|
50
|
+
const vm = wrapper.vm as any
|
|
51
|
+
|
|
35
52
|
// Force booted
|
|
36
|
-
|
|
53
|
+
vm.isBooted = true
|
|
54
|
+
await nextTick()
|
|
37
55
|
|
|
38
|
-
expect(
|
|
56
|
+
expect(vm.computedTransition).toBe('v-window-x-transition')
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
vm.isReverse = true
|
|
59
|
+
await nextTick()
|
|
60
|
+
expect(vm.computedTransition).toBe('v-window-x-reverse-transition')
|
|
42
61
|
|
|
43
|
-
wrapper.setProps({ vertical: true })
|
|
44
|
-
expect(
|
|
62
|
+
await wrapper.setProps({ vertical: true })
|
|
63
|
+
expect(vm.computedTransition).toBe('v-window-y-reverse-transition')
|
|
45
64
|
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
vm.isReverse = false
|
|
66
|
+
await nextTick()
|
|
67
|
+
expect(vm.computedTransition).toBe('v-window-y-transition')
|
|
48
68
|
})
|
|
49
69
|
|
|
50
70
|
it('should set reverse', async () => {
|
|
51
71
|
const wrapper = mountFunction({
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
props: {
|
|
73
|
+
modelValue: 0,
|
|
54
74
|
},
|
|
55
75
|
slots: {
|
|
56
|
-
default: [
|
|
57
|
-
VWindowItem,
|
|
58
|
-
VWindowItem,
|
|
59
|
-
VWindowItem,
|
|
60
|
-
],
|
|
76
|
+
default: () => [h(VWindowItem), h(VWindowItem), h(VWindowItem)],
|
|
61
77
|
},
|
|
62
78
|
})
|
|
63
79
|
|
|
64
|
-
wrapper.
|
|
80
|
+
const vm = wrapper.vm as any
|
|
81
|
+
vm.isBooted = true
|
|
82
|
+
await nextTick()
|
|
65
83
|
|
|
66
84
|
// Reverse implicitly set by changed index
|
|
67
|
-
wrapper.setProps({
|
|
68
|
-
await
|
|
69
|
-
expect(
|
|
85
|
+
await wrapper.setProps({ modelValue: 1 })
|
|
86
|
+
await nextTick()
|
|
87
|
+
expect(vm.isReverse).toBeFalsy()
|
|
70
88
|
|
|
71
89
|
// Reverse implicitly set by changed index
|
|
72
|
-
wrapper.setProps({
|
|
73
|
-
await
|
|
74
|
-
expect(
|
|
90
|
+
await wrapper.setProps({ modelValue: 0 })
|
|
91
|
+
await nextTick()
|
|
92
|
+
expect(vm.isReverse).toBeTruthy()
|
|
75
93
|
|
|
76
94
|
// Reverse explicit prop override
|
|
77
|
-
wrapper.setProps({ reverse: false })
|
|
78
|
-
expect(
|
|
95
|
+
await wrapper.setProps({ reverse: false })
|
|
96
|
+
expect(vm.computedTransition.includes('reverse')).toBeTruthy()
|
|
79
97
|
|
|
80
98
|
// Reverse explicit prop override
|
|
81
|
-
wrapper.setProps({ reverse: true })
|
|
82
|
-
expect(
|
|
99
|
+
await wrapper.setProps({ reverse: true })
|
|
100
|
+
expect(vm.computedTransition.includes('reverse')).toBeFalsy()
|
|
83
101
|
|
|
84
102
|
// Reverts back to local isReverse
|
|
85
|
-
wrapper.setProps({ reverse: undefined })
|
|
86
|
-
expect(
|
|
103
|
+
await wrapper.setProps({ reverse: undefined })
|
|
104
|
+
expect(vm.computedTransition.includes('reverse')).toBeTruthy()
|
|
87
105
|
})
|
|
88
106
|
|
|
89
107
|
it('should increment and decrement current value', async () => {
|
|
90
108
|
const wrapper = mountFunction({
|
|
91
109
|
slots: {
|
|
92
|
-
default: [
|
|
93
|
-
VWindowItem,
|
|
94
|
-
VWindowItem,
|
|
95
|
-
VWindowItem,
|
|
96
|
-
],
|
|
110
|
+
default: () => [h(VWindowItem), h(VWindowItem), h(VWindowItem)],
|
|
97
111
|
},
|
|
98
112
|
})
|
|
99
113
|
|
|
100
|
-
await
|
|
114
|
+
await nextTick()
|
|
115
|
+
const vm = wrapper.vm as any
|
|
101
116
|
|
|
102
|
-
expect(
|
|
117
|
+
expect(vm.internalIndex).toBe(0)
|
|
103
118
|
|
|
104
|
-
|
|
105
|
-
expect(
|
|
119
|
+
vm.next()
|
|
120
|
+
expect(vm.internalIndex).toBe(1)
|
|
106
121
|
|
|
107
|
-
|
|
108
|
-
expect(
|
|
122
|
+
vm.next()
|
|
123
|
+
expect(vm.internalIndex).toBe(2)
|
|
109
124
|
|
|
110
125
|
// changed all following indices
|
|
111
126
|
// due to: https://github.com/vuetifyjs/vuetify/issues/7728
|
|
112
|
-
|
|
113
|
-
expect(
|
|
127
|
+
vm.next()
|
|
128
|
+
expect(vm.internalIndex).toBe(2)
|
|
114
129
|
|
|
115
|
-
|
|
116
|
-
expect(
|
|
130
|
+
vm.prev()
|
|
131
|
+
expect(vm.internalIndex).toBe(1)
|
|
117
132
|
|
|
118
|
-
|
|
119
|
-
expect(
|
|
133
|
+
vm.prev()
|
|
134
|
+
expect(vm.internalIndex).toBe(0)
|
|
120
135
|
|
|
121
|
-
|
|
122
|
-
expect(
|
|
136
|
+
vm.prev()
|
|
137
|
+
expect(vm.internalIndex).toBe(0)
|
|
123
138
|
})
|
|
124
139
|
|
|
125
140
|
it('should update model when internal index is greater than item count', async () => {
|
|
126
141
|
const wrapper = mountFunction({
|
|
127
|
-
|
|
128
|
-
|
|
142
|
+
props: {
|
|
143
|
+
modelValue: 2,
|
|
129
144
|
},
|
|
130
145
|
slots: {
|
|
131
|
-
default: [
|
|
132
|
-
VWindowItem,
|
|
133
|
-
VWindowItem,
|
|
134
|
-
VWindowItem,
|
|
135
|
-
],
|
|
146
|
+
default: () => [h(VWindowItem), h(VWindowItem), h(VWindowItem)],
|
|
136
147
|
},
|
|
137
148
|
})
|
|
138
149
|
|
|
139
|
-
await
|
|
140
|
-
|
|
141
|
-
expect(wrapper.vm.internalIndex).toBe(2)
|
|
150
|
+
await nextTick()
|
|
151
|
+
const vm = wrapper.vm as any
|
|
142
152
|
|
|
143
|
-
|
|
153
|
+
expect(vm.internalIndex).toBe(2)
|
|
144
154
|
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
const wrapper2 = mountFunction({
|
|
156
|
+
props: {
|
|
157
|
+
modelValue: 2,
|
|
158
|
+
},
|
|
159
|
+
slots: {
|
|
160
|
+
default: () => [h(VWindowItem), h(VWindowItem)],
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
await nextTick()
|
|
164
|
+
// modelValue = 2, но элементов только 2 (индексы 0,1), поэтому internalIndex должен быть -1
|
|
165
|
+
expect((wrapper2.vm as any).internalIndex).toBe(-1)
|
|
147
166
|
|
|
148
|
-
|
|
149
|
-
|
|
167
|
+
const wrapper3 = mountFunction({
|
|
168
|
+
props: {
|
|
169
|
+
modelValue: 1,
|
|
170
|
+
},
|
|
171
|
+
slots: {
|
|
172
|
+
default: () => [h(VWindowItem)],
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
await nextTick()
|
|
176
|
+
// modelValue = 1, но элементов только 1 (индекс 0), поэтому internalIndex должен быть -1
|
|
177
|
+
expect((wrapper3.vm as any).internalIndex).toBe(-1)
|
|
150
178
|
|
|
151
|
-
|
|
152
|
-
|
|
179
|
+
const wrapper4 = mountFunction({
|
|
180
|
+
props: {
|
|
181
|
+
modelValue: 0,
|
|
182
|
+
},
|
|
183
|
+
slots: {
|
|
184
|
+
default: () => [],
|
|
185
|
+
},
|
|
186
|
+
})
|
|
187
|
+
await nextTick()
|
|
188
|
+
// modelValue = 0, но элементов нет, поэтому internalIndex должен быть -1
|
|
189
|
+
expect((wrapper4.vm as any).internalIndex).toBe(-1)
|
|
153
190
|
})
|
|
154
191
|
|
|
155
192
|
it('should react to touch', async () => {
|
|
156
193
|
const wrapper = mountFunction({
|
|
157
|
-
|
|
194
|
+
props: { modelValue: 1 },
|
|
158
195
|
slots: {
|
|
159
|
-
default: [
|
|
160
|
-
VWindowItem,
|
|
161
|
-
VWindowItem,
|
|
162
|
-
VWindowItem,
|
|
163
|
-
VWindowItem,
|
|
164
|
-
VWindowItem,
|
|
196
|
+
default: () => [
|
|
197
|
+
h(VWindowItem),
|
|
198
|
+
h(VWindowItem),
|
|
199
|
+
h(VWindowItem),
|
|
200
|
+
h(VWindowItem),
|
|
201
|
+
h(VWindowItem),
|
|
165
202
|
],
|
|
166
203
|
},
|
|
167
204
|
})
|
|
168
205
|
|
|
169
|
-
await
|
|
206
|
+
await nextTick()
|
|
207
|
+
const vm = wrapper.vm as any
|
|
170
208
|
|
|
171
|
-
expect(
|
|
172
|
-
touch(wrapper)
|
|
173
|
-
|
|
209
|
+
expect(vm.internalIndex).toBe(1)
|
|
210
|
+
touch(wrapper)
|
|
211
|
+
.start(0, 0)
|
|
212
|
+
.end(200, 0)
|
|
213
|
+
expect(vm.internalIndex).toBe(0)
|
|
174
214
|
|
|
175
215
|
// changed expected indices due to:
|
|
176
216
|
// https://github.com/vuetifyjs/vuetify/issues/7728
|
|
177
|
-
touch(wrapper)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
expect(
|
|
186
|
-
|
|
187
|
-
wrapper.setProps({
|
|
188
|
-
touch(wrapper)
|
|
189
|
-
|
|
217
|
+
touch(wrapper)
|
|
218
|
+
.start(0, 0)
|
|
219
|
+
.end(200, 0)
|
|
220
|
+
expect(vm.internalIndex).toBe(0)
|
|
221
|
+
|
|
222
|
+
touch(wrapper)
|
|
223
|
+
.start(200, 0)
|
|
224
|
+
.end(0, 0)
|
|
225
|
+
expect(vm.internalIndex).toBe(1)
|
|
226
|
+
|
|
227
|
+
await wrapper.setProps({ modelValue: 4 })
|
|
228
|
+
touch(wrapper)
|
|
229
|
+
.start(200, 0)
|
|
230
|
+
.end(0, 0)
|
|
231
|
+
expect(vm.internalIndex).toBe(4)
|
|
232
|
+
|
|
233
|
+
await wrapper.setProps({ modelValue: 0 })
|
|
234
|
+
touch(wrapper)
|
|
235
|
+
.start(0, 0)
|
|
236
|
+
.end(200, 0)
|
|
237
|
+
expect(vm.internalIndex).toBe(0)
|
|
190
238
|
})
|
|
191
239
|
|
|
192
240
|
it('should accept a custom touch object', async () => {
|
|
@@ -194,25 +242,29 @@ describe('VWindow.ts', () => {
|
|
|
194
242
|
const right = jest.fn()
|
|
195
243
|
const fns = { left, right }
|
|
196
244
|
const wrapper = mountFunction({
|
|
197
|
-
|
|
245
|
+
props: {
|
|
198
246
|
touch: fns,
|
|
199
|
-
|
|
247
|
+
modelValue: 1,
|
|
200
248
|
},
|
|
201
249
|
slots: {
|
|
202
|
-
default: [
|
|
203
|
-
VWindowItem,
|
|
204
|
-
VWindowItem,
|
|
205
|
-
VWindowItem,
|
|
206
|
-
VWindowItem,
|
|
207
|
-
VWindowItem,
|
|
250
|
+
default: () => [
|
|
251
|
+
h(VWindowItem),
|
|
252
|
+
h(VWindowItem),
|
|
253
|
+
h(VWindowItem),
|
|
254
|
+
h(VWindowItem),
|
|
255
|
+
h(VWindowItem),
|
|
208
256
|
],
|
|
209
257
|
},
|
|
210
258
|
})
|
|
211
259
|
|
|
212
|
-
await
|
|
260
|
+
await nextTick()
|
|
213
261
|
|
|
214
|
-
touch(wrapper)
|
|
215
|
-
|
|
262
|
+
touch(wrapper)
|
|
263
|
+
.start(200, 0)
|
|
264
|
+
.end(0, 0)
|
|
265
|
+
touch(wrapper)
|
|
266
|
+
.start(0, 0)
|
|
267
|
+
.end(200, 0)
|
|
216
268
|
expect(left).toHaveBeenCalled()
|
|
217
269
|
expect(right).toHaveBeenCalled()
|
|
218
270
|
})
|
|
@@ -221,140 +273,129 @@ describe('VWindow.ts', () => {
|
|
|
221
273
|
it('should change to the next available index when using touch swipe', () => {
|
|
222
274
|
const wrapper = mountFunction({
|
|
223
275
|
slots: {
|
|
224
|
-
default: [
|
|
225
|
-
{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
disabled: {
|
|
229
|
-
type: Boolean,
|
|
230
|
-
default: true,
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
VWindowItem,
|
|
235
|
-
VWindowItem,
|
|
276
|
+
default: () => [
|
|
277
|
+
h(VWindowItem, { disabled: true }),
|
|
278
|
+
h(VWindowItem),
|
|
279
|
+
h(VWindowItem),
|
|
236
280
|
],
|
|
237
281
|
},
|
|
238
282
|
})
|
|
239
283
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
284
|
+
const vm = wrapper.vm as any
|
|
285
|
+
expect(vm.internalIndex).toBe(1)
|
|
286
|
+
touch(wrapper)
|
|
287
|
+
.start(0, 0)
|
|
288
|
+
.end(200, 0)
|
|
289
|
+
expect(vm.internalIndex).toBe(2)
|
|
290
|
+
touch(wrapper)
|
|
291
|
+
.start(0, 0)
|
|
292
|
+
.end(200, 0)
|
|
293
|
+
expect(vm.internalIndex).toBe(1)
|
|
245
294
|
})
|
|
246
295
|
|
|
247
296
|
it('should generate and show arrows', async () => {
|
|
248
297
|
const wrapper = mountFunction({
|
|
249
|
-
|
|
298
|
+
props: {
|
|
250
299
|
showArrows: true,
|
|
251
300
|
},
|
|
252
301
|
slots: {
|
|
253
|
-
default: [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
302
|
+
default: () => [
|
|
303
|
+
h(VWindowItem),
|
|
304
|
+
h(VWindowItem),
|
|
305
|
+
h(VWindowItem),
|
|
306
|
+
h(VWindowItem),
|
|
258
307
|
],
|
|
259
308
|
},
|
|
260
309
|
})
|
|
261
310
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
expect(wrapper.vm.hasNext).toBe(true)
|
|
265
|
-
expect(wrapper.vm.hasPrev).toBe(false)
|
|
266
|
-
|
|
267
|
-
next.trigger('click')
|
|
311
|
+
await nextTick()
|
|
312
|
+
const vm = wrapper.vm as any
|
|
268
313
|
|
|
269
|
-
|
|
314
|
+
expect(vm.hasNext).toBe(true)
|
|
315
|
+
expect(vm.hasPrev).toBe(false)
|
|
270
316
|
|
|
271
|
-
|
|
272
|
-
|
|
317
|
+
// Используем методы компонента напрямую вместо поиска DOM элементов
|
|
318
|
+
vm.next()
|
|
319
|
+
await nextTick()
|
|
273
320
|
|
|
274
|
-
|
|
275
|
-
|
|
321
|
+
expect(vm.hasNext).toBe(true)
|
|
322
|
+
expect(vm.hasPrev).toBe(true)
|
|
276
323
|
|
|
277
|
-
|
|
324
|
+
vm.next()
|
|
325
|
+
vm.next()
|
|
326
|
+
await nextTick()
|
|
278
327
|
|
|
279
|
-
expect(
|
|
280
|
-
expect(
|
|
328
|
+
expect(vm.hasNext).toBe(false)
|
|
329
|
+
expect(vm.hasPrev).toBe(true)
|
|
281
330
|
|
|
282
|
-
wrapper.setProps({ continuous: true })
|
|
331
|
+
await wrapper.setProps({ continuous: true })
|
|
283
332
|
|
|
284
|
-
expect(
|
|
285
|
-
expect(
|
|
333
|
+
expect(vm.hasNext).toBe(true)
|
|
334
|
+
expect(vm.hasPrev).toBe(true)
|
|
286
335
|
})
|
|
287
336
|
|
|
288
337
|
it('should skip disabled items and go to the next available', () => {
|
|
289
|
-
const props = {
|
|
290
|
-
disabled: {
|
|
291
|
-
type: Boolean,
|
|
292
|
-
default: true,
|
|
293
|
-
},
|
|
294
|
-
}
|
|
295
338
|
const wrapper = mountFunction({
|
|
296
339
|
slots: {
|
|
297
|
-
default: [
|
|
298
|
-
|
|
299
|
-
{
|
|
300
|
-
{
|
|
301
|
-
|
|
340
|
+
default: () => [
|
|
341
|
+
h(VWindowItem),
|
|
342
|
+
h(VWindowItem, { disabled: true }),
|
|
343
|
+
h(VWindowItem, { disabled: true }),
|
|
344
|
+
h(VWindowItem),
|
|
302
345
|
],
|
|
303
346
|
},
|
|
304
347
|
})
|
|
305
348
|
|
|
306
|
-
|
|
349
|
+
const vm = wrapper.vm as any
|
|
350
|
+
expect(vm.internalIndex).toBe(0)
|
|
307
351
|
|
|
308
|
-
|
|
352
|
+
vm.next()
|
|
309
353
|
|
|
310
|
-
expect(
|
|
354
|
+
expect(vm.internalIndex).toBe(3)
|
|
311
355
|
})
|
|
312
356
|
|
|
313
357
|
it('should ignore touch events', () => {
|
|
314
358
|
const wrapper = mountFunction({
|
|
315
|
-
|
|
359
|
+
props: { touchless: true },
|
|
316
360
|
slots: {
|
|
317
|
-
default: [
|
|
318
|
-
{ extends: VWindowItem },
|
|
319
|
-
{ extends: VWindowItem },
|
|
320
|
-
],
|
|
361
|
+
default: () => [h(VWindowItem), h(VWindowItem)],
|
|
321
362
|
},
|
|
322
363
|
})
|
|
323
364
|
|
|
324
|
-
|
|
365
|
+
const vm = wrapper.vm as any
|
|
366
|
+
expect(vm.internalIndex).toBe(0)
|
|
325
367
|
|
|
326
|
-
touch(wrapper)
|
|
368
|
+
touch(wrapper)
|
|
369
|
+
.start(0, 0)
|
|
370
|
+
.end(200, 0)
|
|
327
371
|
|
|
328
|
-
expect(
|
|
372
|
+
expect(vm.internalIndex).toBe(0)
|
|
329
373
|
})
|
|
330
374
|
|
|
331
375
|
// https://github.com/vuetifyjs/vuetify/issues/7728
|
|
332
376
|
it('should not "wrap around" when continuous === false', () => {
|
|
333
377
|
const wrapper = mountFunction({
|
|
334
|
-
|
|
378
|
+
props: {
|
|
335
379
|
continuous: false,
|
|
336
380
|
},
|
|
337
381
|
slots: {
|
|
338
|
-
default: [
|
|
339
|
-
{ extends: VWindowItem },
|
|
340
|
-
{ extends: VWindowItem },
|
|
341
|
-
{ extends: VWindowItem },
|
|
342
|
-
],
|
|
382
|
+
default: () => [h(VWindowItem), h(VWindowItem), h(VWindowItem)],
|
|
343
383
|
},
|
|
344
384
|
})
|
|
345
385
|
|
|
386
|
+
const vm = wrapper.vm as any
|
|
346
387
|
// by default we expect the internalIndex to be 0
|
|
347
|
-
expect(
|
|
388
|
+
expect(vm.internalIndex).toBe(0)
|
|
348
389
|
// now call the prev() function
|
|
349
|
-
|
|
350
|
-
expect(
|
|
390
|
+
vm.prev()
|
|
391
|
+
expect(vm.internalIndex).toBe(0)
|
|
351
392
|
// now advance to the end
|
|
352
|
-
|
|
353
|
-
expect(
|
|
354
|
-
|
|
355
|
-
expect(
|
|
393
|
+
vm.next()
|
|
394
|
+
expect(vm.internalIndex).toBe(1)
|
|
395
|
+
vm.next()
|
|
396
|
+
expect(vm.internalIndex).toBe(2)
|
|
356
397
|
// it should not be able to advance past the end
|
|
357
|
-
|
|
358
|
-
expect(
|
|
398
|
+
vm.next()
|
|
399
|
+
expect(vm.internalIndex).toBe(2)
|
|
359
400
|
})
|
|
360
401
|
})
|