@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,29 +1,20 @@
|
|
|
1
|
-
// Libraries
|
|
2
|
-
import Vue from 'vue'
|
|
3
|
-
|
|
4
1
|
// Components
|
|
5
2
|
import VLabel from '../VLabel'
|
|
6
3
|
|
|
7
4
|
// Utilities
|
|
8
5
|
import {
|
|
9
|
-
createLocalVue,
|
|
10
6
|
mount,
|
|
11
|
-
|
|
7
|
+
VueWrapper,
|
|
12
8
|
} from '@vue/test-utils'
|
|
13
9
|
|
|
14
10
|
describe('VLabel', () => {
|
|
15
|
-
|
|
16
|
-
let
|
|
11
|
+
type Instance = InstanceType<typeof VLabel>
|
|
12
|
+
let mountFunction: (options?: any) => VueWrapper<Instance>
|
|
17
13
|
|
|
18
14
|
beforeEach(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mountFunction = (ctx = {}) => {
|
|
15
|
+
mountFunction = (options = {}) => {
|
|
22
16
|
return mount(VLabel, {
|
|
23
|
-
|
|
24
|
-
context: {
|
|
25
|
-
...ctx,
|
|
26
|
-
},
|
|
17
|
+
...options,
|
|
27
18
|
})
|
|
28
19
|
}
|
|
29
20
|
})
|
|
@@ -48,4 +39,239 @@ describe('VLabel', () => {
|
|
|
48
39
|
|
|
49
40
|
expect(wrapper.element.style.position).toBe('absolute')
|
|
50
41
|
})
|
|
42
|
+
|
|
43
|
+
it('should render default slot content', () => {
|
|
44
|
+
const wrapper = mountFunction({
|
|
45
|
+
slots: {
|
|
46
|
+
default: 'Custom Label Text',
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
expect(wrapper.text()).toBe('Custom Label Text')
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('should render complex slot content with HTML', () => {
|
|
54
|
+
const wrapper = mountFunction({
|
|
55
|
+
slots: {
|
|
56
|
+
default: '<span class="custom-class">Label with <strong>bold</strong> text</span>',
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
expect(wrapper.find('.custom-class').exists()).toBe(true)
|
|
61
|
+
expect(wrapper.find('strong').exists()).toBe(true)
|
|
62
|
+
expect(wrapper.find('strong').text()).toBe('bold')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('should render slot content with components', () => {
|
|
66
|
+
const TestComponent = {
|
|
67
|
+
template: '<span class="test-component">Test Component</span>',
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const wrapper = mountFunction({
|
|
71
|
+
slots: {
|
|
72
|
+
default: TestComponent,
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
expect(wrapper.find('.test-component').exists()).toBe(true)
|
|
77
|
+
expect(wrapper.find('.test-component').text()).toBe('Test Component')
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('should render slot content with multiple elements', () => {
|
|
81
|
+
const wrapper = mountFunction({
|
|
82
|
+
slots: {
|
|
83
|
+
default: [
|
|
84
|
+
'<span class="first">First</span>',
|
|
85
|
+
'<span class="second">Second</span>',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
expect(wrapper.find('.first').exists()).toBe(true)
|
|
91
|
+
expect(wrapper.find('.second').exists()).toBe(true)
|
|
92
|
+
expect(wrapper.find('.first').text()).toBe('First')
|
|
93
|
+
expect(wrapper.find('.second').text()).toBe('Second')
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('should render empty content when no slot provided', () => {
|
|
97
|
+
const wrapper = mountFunction()
|
|
98
|
+
|
|
99
|
+
expect(wrapper.text()).toBe('')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('should apply proper classes when slot content is present', () => {
|
|
103
|
+
const wrapper = mountFunction({
|
|
104
|
+
slots: {
|
|
105
|
+
default: 'Test Label',
|
|
106
|
+
},
|
|
107
|
+
props: {
|
|
108
|
+
value: true,
|
|
109
|
+
disabled: true,
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
expect(wrapper.classes('v-label--active')).toBe(true)
|
|
114
|
+
expect(wrapper.classes('v-label--is-disabled')).toBe(true)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it('should render slot content with proper for attribute', () => {
|
|
118
|
+
const wrapper = mountFunction({
|
|
119
|
+
props: {
|
|
120
|
+
for: 'test-input',
|
|
121
|
+
},
|
|
122
|
+
slots: {
|
|
123
|
+
default: 'Label for input',
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
expect(wrapper.attributes('for')).toBe('test-input')
|
|
128
|
+
expect(wrapper.attributes('aria-hidden')).toBe('false')
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
it('should set aria-hidden when no for attribute provided', () => {
|
|
132
|
+
const wrapper = mountFunction({
|
|
133
|
+
slots: {
|
|
134
|
+
default: 'Label without for',
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
expect(wrapper.attributes('aria-hidden')).toBe('true')
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it('should render slot content with proper positioning', () => {
|
|
142
|
+
const wrapper = mountFunction({
|
|
143
|
+
props: {
|
|
144
|
+
left: 10,
|
|
145
|
+
right: 20,
|
|
146
|
+
},
|
|
147
|
+
slots: {
|
|
148
|
+
default: 'Positioned label',
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
expect(wrapper.element.style.left).toBe('10px')
|
|
153
|
+
expect(wrapper.element.style.right).toBe('20px')
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('should render slot content with theme classes', () => {
|
|
157
|
+
const wrapper = mountFunction({
|
|
158
|
+
props: {
|
|
159
|
+
dark: true,
|
|
160
|
+
},
|
|
161
|
+
slots: {
|
|
162
|
+
default: 'Dark theme label',
|
|
163
|
+
},
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
expect(wrapper.classes('theme--dark')).toBe(true)
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
it('should handle focused state with color', () => {
|
|
170
|
+
const wrapper = mountFunction({
|
|
171
|
+
props: {
|
|
172
|
+
focused: true,
|
|
173
|
+
color: 'error',
|
|
174
|
+
},
|
|
175
|
+
slots: {
|
|
176
|
+
default: 'Focused error label',
|
|
177
|
+
},
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
expect(wrapper.classes('error--text')).toBe(true)
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
it('should handle disabled state', () => {
|
|
184
|
+
const wrapper = mountFunction({
|
|
185
|
+
props: {
|
|
186
|
+
disabled: true,
|
|
187
|
+
},
|
|
188
|
+
slots: {
|
|
189
|
+
default: 'Disabled label',
|
|
190
|
+
},
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
expect(wrapper.classes('v-label--is-disabled')).toBe(true)
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
it('should handle active state', () => {
|
|
197
|
+
const wrapper = mountFunction({
|
|
198
|
+
props: {
|
|
199
|
+
value: true,
|
|
200
|
+
},
|
|
201
|
+
slots: {
|
|
202
|
+
default: 'Active label',
|
|
203
|
+
},
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
expect(wrapper.classes('v-label--active')).toBe(true)
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
it('should handle custom positioning with string values', () => {
|
|
210
|
+
const wrapper = mountFunction({
|
|
211
|
+
props: {
|
|
212
|
+
left: '20%',
|
|
213
|
+
right: '30px',
|
|
214
|
+
},
|
|
215
|
+
slots: {
|
|
216
|
+
default: 'Positioned label',
|
|
217
|
+
},
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
expect(wrapper.element.style.left).toBe('20%')
|
|
221
|
+
expect(wrapper.element.style.right).toBe('30px')
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
it('should handle light theme', () => {
|
|
225
|
+
const wrapper = mountFunction({
|
|
226
|
+
props: {
|
|
227
|
+
light: true,
|
|
228
|
+
},
|
|
229
|
+
slots: {
|
|
230
|
+
default: 'Light theme label',
|
|
231
|
+
},
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
expect(wrapper.classes('theme--light')).toBe(true)
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
it('should handle multiple theme classes', () => {
|
|
238
|
+
const wrapper = mountFunction({
|
|
239
|
+
props: {
|
|
240
|
+
dark: true,
|
|
241
|
+
light: false,
|
|
242
|
+
},
|
|
243
|
+
slots: {
|
|
244
|
+
default: 'Theme label',
|
|
245
|
+
},
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
expect(wrapper.classes('theme--dark')).toBe(true)
|
|
249
|
+
expect(wrapper.classes('theme--light')).toBe(false)
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it('should render slot content with proper element tag', () => {
|
|
253
|
+
const wrapper = mountFunction({
|
|
254
|
+
slots: {
|
|
255
|
+
default: 'Label content',
|
|
256
|
+
},
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
expect(wrapper.element.tagName.toLowerCase()).toBe('label')
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
it('should handle slot content with event listeners', () => {
|
|
263
|
+
const onClick = jest.fn()
|
|
264
|
+
|
|
265
|
+
const wrapper = mountFunction({
|
|
266
|
+
attrs: {
|
|
267
|
+
onClick,
|
|
268
|
+
},
|
|
269
|
+
slots: {
|
|
270
|
+
default: 'Clickable label',
|
|
271
|
+
},
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
wrapper.trigger('click')
|
|
275
|
+
expect(onClick).toHaveBeenCalled()
|
|
276
|
+
})
|
|
51
277
|
})
|
|
@@ -6,12 +6,15 @@ import {
|
|
|
6
6
|
mount,
|
|
7
7
|
MountOptions,
|
|
8
8
|
Wrapper,
|
|
9
|
+
enableAutoUnmount,
|
|
9
10
|
} from '@vue/test-utils'
|
|
10
11
|
|
|
11
12
|
describe('VLazy.ts', () => {
|
|
12
13
|
type Instance = InstanceType<typeof VLazy>
|
|
13
14
|
let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
|
|
14
15
|
|
|
16
|
+
enableAutoUnmount(afterEach)
|
|
17
|
+
|
|
15
18
|
beforeEach(() => {
|
|
16
19
|
mountFunction = (options = {}) => {
|
|
17
20
|
return mount(VLazy, {
|
|
@@ -29,16 +32,14 @@ describe('VLazy.ts', () => {
|
|
|
29
32
|
|
|
30
33
|
expect(wrapper.html()).toMatchSnapshot()
|
|
31
34
|
|
|
32
|
-
wrapper.setProps({
|
|
33
|
-
|
|
34
|
-
await wrapper.vm.$nextTick()
|
|
35
|
+
await wrapper.setProps({ modelValue: true })
|
|
35
36
|
|
|
36
37
|
expect(wrapper.html()).toMatchSnapshot()
|
|
37
38
|
})
|
|
38
39
|
|
|
39
40
|
it('should set a minimum height', () => {
|
|
40
41
|
const wrapper = mountFunction({
|
|
41
|
-
|
|
42
|
+
props: {
|
|
42
43
|
minHeight: 200,
|
|
43
44
|
},
|
|
44
45
|
})
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`VLazy.ts should conditionally render content 1`] = `
|
|
4
4
|
<div class="v-lazy">
|
|
5
|
+
false
|
|
5
6
|
</div>
|
|
6
7
|
`;
|
|
7
8
|
|
|
8
9
|
exports[`VLazy.ts should conditionally render content 2`] = `
|
|
9
10
|
<div class="v-lazy">
|
|
10
|
-
<div>
|
|
11
|
+
<div class="fade-transition-enter-from fade-transition-enter-active">
|
|
11
12
|
foobar
|
|
12
13
|
</div>
|
|
13
14
|
</div>
|
|
@@ -41,7 +41,6 @@ interface options extends ExtractVue<typeof baseMixins> {
|
|
|
41
41
|
export default baseMixins.extend({
|
|
42
42
|
name: 'v-list-item',
|
|
43
43
|
|
|
44
|
-
|
|
45
44
|
inject: {
|
|
46
45
|
isInGroup: {
|
|
47
46
|
default: false,
|
|
@@ -65,6 +64,7 @@ export default baseMixins.extend({
|
|
|
65
64
|
} as any as PropValidator<string>,
|
|
66
65
|
dense: Boolean,
|
|
67
66
|
inactive: Boolean,
|
|
67
|
+
onClick: Function as PropType<(e: MouseEvent) => void>,
|
|
68
68
|
link: Boolean,
|
|
69
69
|
selectable: {
|
|
70
70
|
type: Boolean,
|
|
@@ -194,10 +194,16 @@ export default baseMixins.extend({
|
|
|
194
194
|
// delete data.nativeOn
|
|
195
195
|
// }
|
|
196
196
|
|
|
197
|
-
const
|
|
197
|
+
const slotProps = {
|
|
198
198
|
active: this.isActive,
|
|
199
199
|
toggle: this.toggle,
|
|
200
|
-
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const children = [
|
|
203
|
+
getSlot(this, 'prepend', slotProps),
|
|
204
|
+
getSlot(this, 'default', slotProps),
|
|
205
|
+
getSlot(this, 'append', slotProps),
|
|
206
|
+
].filter(Boolean)
|
|
201
207
|
|
|
202
208
|
const nodeData = this.isActive ? this.setTextColor(this.color, data) : data
|
|
203
209
|
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
import VList from '../VList'
|
|
3
3
|
|
|
4
4
|
// Utilities
|
|
5
|
-
import {
|
|
6
|
-
mount,
|
|
7
|
-
Wrapper,
|
|
8
|
-
} from '@vue/test-utils'
|
|
5
|
+
import { mount, VueWrapper } from '@vue/test-utils'
|
|
9
6
|
|
|
10
7
|
describe('VList.ts', () => {
|
|
11
|
-
type Instance = InstanceType<typeof VList
|
|
12
|
-
let mountFunction: (options?:
|
|
8
|
+
type Instance = InstanceType<typeof VList>;
|
|
9
|
+
let mountFunction: (options?: any) => VueWrapper<Instance>
|
|
13
10
|
|
|
14
11
|
beforeEach(() => {
|
|
15
12
|
mountFunction = (options = {}) => {
|
|
@@ -27,7 +24,7 @@ describe('VList.ts', () => {
|
|
|
27
24
|
|
|
28
25
|
it('should render a dense component and match snapshot', () => {
|
|
29
26
|
const wrapper = mountFunction({
|
|
30
|
-
|
|
27
|
+
props: {
|
|
31
28
|
dense: true,
|
|
32
29
|
},
|
|
33
30
|
})
|
|
@@ -37,7 +34,7 @@ describe('VList.ts', () => {
|
|
|
37
34
|
|
|
38
35
|
it('should render a subheader component and match snapshot', () => {
|
|
39
36
|
const wrapper = mountFunction({
|
|
40
|
-
|
|
37
|
+
props: {
|
|
41
38
|
subheader: true,
|
|
42
39
|
},
|
|
43
40
|
})
|
|
@@ -47,7 +44,7 @@ describe('VList.ts', () => {
|
|
|
47
44
|
|
|
48
45
|
it('should render a threeLine component and match snapshot', () => {
|
|
49
46
|
const wrapper = mountFunction({
|
|
50
|
-
|
|
47
|
+
props: {
|
|
51
48
|
threeLine: true,
|
|
52
49
|
},
|
|
53
50
|
})
|
|
@@ -57,7 +54,7 @@ describe('VList.ts', () => {
|
|
|
57
54
|
|
|
58
55
|
it('should render a twoLine component and match snapshot', () => {
|
|
59
56
|
const wrapper = mountFunction({
|
|
60
|
-
|
|
57
|
+
props: {
|
|
61
58
|
twoLine: true,
|
|
62
59
|
},
|
|
63
60
|
})
|
|
@@ -67,13 +64,17 @@ describe('VList.ts', () => {
|
|
|
67
64
|
|
|
68
65
|
it('should have an inferred role from injections', () => {
|
|
69
66
|
const wrapper = mountFunction({
|
|
70
|
-
|
|
67
|
+
global: {
|
|
68
|
+
provide: { isInMenu: true },
|
|
69
|
+
},
|
|
71
70
|
})
|
|
72
71
|
|
|
73
72
|
expect(wrapper.element.getAttribute('role')).toBeNull()
|
|
74
73
|
|
|
75
74
|
const wrapper2 = mountFunction({
|
|
76
|
-
|
|
75
|
+
global: {
|
|
76
|
+
provide: { isInNav: true },
|
|
77
|
+
},
|
|
77
78
|
})
|
|
78
79
|
|
|
79
80
|
expect(wrapper2.element.getAttribute('role')).toBeNull()
|
|
@@ -4,12 +4,15 @@ import VListGroup from '../VListGroup'
|
|
|
4
4
|
// Utilities
|
|
5
5
|
import {
|
|
6
6
|
mount,
|
|
7
|
-
|
|
7
|
+
VueWrapper,
|
|
8
|
+
enableAutoUnmount,
|
|
8
9
|
} from '@vue/test-utils'
|
|
9
10
|
|
|
10
11
|
describe('VListGroup.ts', () => {
|
|
11
12
|
type Instance = InstanceType<typeof VListGroup>
|
|
12
|
-
let mountFunction: (options?: object) =>
|
|
13
|
+
let mountFunction: (options?: object) => VueWrapper<Instance>
|
|
14
|
+
|
|
15
|
+
enableAutoUnmount(afterEach)
|
|
13
16
|
|
|
14
17
|
beforeEach(() => {
|
|
15
18
|
mountFunction = (options = {}) => {
|
|
@@ -29,42 +32,49 @@ describe('VListGroup.ts', () => {
|
|
|
29
32
|
const $route = { path: '/foo' }
|
|
30
33
|
const listClick = jest.fn()
|
|
31
34
|
const wrapper = mountFunction({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
global: {
|
|
36
|
+
provide: {
|
|
37
|
+
list: {
|
|
38
|
+
listClick,
|
|
39
|
+
register: jest.fn(),
|
|
40
|
+
unregister: jest.fn(),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
mocks: {
|
|
44
|
+
$route,
|
|
37
45
|
},
|
|
38
46
|
},
|
|
39
|
-
|
|
47
|
+
props: {
|
|
40
48
|
group: 'foo',
|
|
41
49
|
},
|
|
42
|
-
mocks: {
|
|
43
|
-
$route,
|
|
44
|
-
},
|
|
45
50
|
})
|
|
46
51
|
|
|
47
52
|
await wrapper.vm.$nextTick()
|
|
48
|
-
expect(listClick).toHaveBeenCalledWith(wrapper.vm
|
|
53
|
+
expect(listClick).toHaveBeenCalledWith(wrapper.vm.$.uid)
|
|
49
54
|
})
|
|
50
55
|
|
|
51
56
|
it('should toggle when clicked', async () => {
|
|
52
|
-
const wrapper = mountFunction(
|
|
57
|
+
const wrapper = mountFunction({
|
|
58
|
+
props: {
|
|
59
|
+
modelValue: false,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
53
62
|
|
|
54
|
-
const input = jest.fn()
|
|
55
|
-
wrapper.vm.$on('input', input)
|
|
56
63
|
wrapper.vm.click()
|
|
57
64
|
await wrapper.vm.$nextTick()
|
|
58
|
-
expect(
|
|
65
|
+
expect(wrapper.emitted('click')).toBeTruthy()
|
|
66
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
59
67
|
})
|
|
60
68
|
|
|
61
69
|
it('should register when mounted', () => {
|
|
62
70
|
const register = jest.fn()
|
|
63
71
|
const wrapper = mountFunction({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
global: {
|
|
73
|
+
provide: {
|
|
74
|
+
list: {
|
|
75
|
+
register,
|
|
76
|
+
unregister: () => {},
|
|
77
|
+
},
|
|
68
78
|
},
|
|
69
79
|
},
|
|
70
80
|
})
|
|
@@ -75,15 +85,17 @@ describe('VListGroup.ts', () => {
|
|
|
75
85
|
it('should unregister when destroyed', async () => {
|
|
76
86
|
const unregister = jest.fn()
|
|
77
87
|
const wrapper = mountFunction({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
global: {
|
|
89
|
+
provide: {
|
|
90
|
+
list: {
|
|
91
|
+
register: () => {},
|
|
92
|
+
unregister,
|
|
93
|
+
},
|
|
82
94
|
},
|
|
83
95
|
},
|
|
84
96
|
})
|
|
85
97
|
|
|
86
|
-
wrapper.
|
|
98
|
+
wrapper.unmount()
|
|
87
99
|
await wrapper.vm.$nextTick()
|
|
88
100
|
expect(unregister).toHaveBeenCalledWith(wrapper.vm)
|
|
89
101
|
})
|
|
@@ -91,12 +103,8 @@ describe('VListGroup.ts', () => {
|
|
|
91
103
|
it('should render a custom affix icons', async () => {
|
|
92
104
|
const wrapper = mountFunction({
|
|
93
105
|
slots: {
|
|
94
|
-
appendIcon:
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
prependIcon: {
|
|
98
|
-
render: h => h('span', 'bar'),
|
|
99
|
-
},
|
|
106
|
+
appendIcon: '<span>foo</span>',
|
|
107
|
+
prependIcon: '<span>bar</span>',
|
|
100
108
|
},
|
|
101
109
|
})
|
|
102
110
|
|
|
@@ -104,10 +112,8 @@ describe('VListGroup.ts', () => {
|
|
|
104
112
|
expect(wrapper.html()).toContain('<span>bar</span>')
|
|
105
113
|
})
|
|
106
114
|
|
|
107
|
-
it('should respond to keydown.enter on header', () => {
|
|
108
|
-
const click = jest.fn()
|
|
115
|
+
it('should respond to keydown.enter on header', async () => {
|
|
109
116
|
const wrapper = mountFunction({
|
|
110
|
-
methods: { click },
|
|
111
117
|
slots: {
|
|
112
118
|
activator: {
|
|
113
119
|
template: '<span>foo</span>',
|
|
@@ -117,26 +123,28 @@ describe('VListGroup.ts', () => {
|
|
|
117
123
|
|
|
118
124
|
const span = wrapper.find('span')
|
|
119
125
|
|
|
120
|
-
span.trigger('keydown.enter')
|
|
126
|
+
await span.trigger('keydown.enter')
|
|
121
127
|
|
|
122
|
-
expect(
|
|
128
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
123
129
|
})
|
|
124
130
|
|
|
125
131
|
it('should set active state if route changes and group present', async () => {
|
|
126
132
|
const listClick = jest.fn()
|
|
127
133
|
const $route = { path: '/bar' }
|
|
128
134
|
const wrapper = mountFunction({
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
global: {
|
|
136
|
+
provide: {
|
|
137
|
+
list: {
|
|
138
|
+
listClick,
|
|
139
|
+
register: () => {},
|
|
140
|
+
unregister: () => {},
|
|
141
|
+
},
|
|
134
142
|
},
|
|
143
|
+
mocks: { $route },
|
|
135
144
|
},
|
|
136
|
-
|
|
145
|
+
props: {
|
|
137
146
|
group: 'foo',
|
|
138
147
|
},
|
|
139
|
-
mocks: { $route },
|
|
140
148
|
})
|
|
141
149
|
|
|
142
150
|
expect(wrapper.vm.isActive).toBe(false)
|
|
@@ -146,12 +154,12 @@ describe('VListGroup.ts', () => {
|
|
|
146
154
|
wrapper.vm.onRouteChange(wrapper.vm.$route)
|
|
147
155
|
|
|
148
156
|
expect(wrapper.vm.isActive).toBe(true)
|
|
149
|
-
expect(listClick).toHaveBeenCalledWith(wrapper.vm
|
|
157
|
+
expect(listClick).toHaveBeenCalledWith(wrapper.vm.$.uid)
|
|
150
158
|
})
|
|
151
159
|
|
|
152
|
-
it('should not react to clicks when disabled', () => {
|
|
160
|
+
it('should not react to clicks when disabled', async () => {
|
|
153
161
|
const wrapper = mountFunction({
|
|
154
|
-
|
|
162
|
+
props: {
|
|
155
163
|
disabled: true,
|
|
156
164
|
},
|
|
157
165
|
slots: {
|
|
@@ -162,7 +170,7 @@ describe('VListGroup.ts', () => {
|
|
|
162
170
|
const span = wrapper.find('span.bar')
|
|
163
171
|
|
|
164
172
|
expect(wrapper.vm.isActive).toBe(false)
|
|
165
|
-
span.trigger('click')
|
|
173
|
+
await span.trigger('click')
|
|
166
174
|
expect(wrapper.vm.isActive).toBe(false)
|
|
167
175
|
})
|
|
168
176
|
|
|
@@ -173,20 +181,20 @@ describe('VListGroup.ts', () => {
|
|
|
173
181
|
wrapper.vm.toggle(100)
|
|
174
182
|
await wrapper.vm.$nextTick()
|
|
175
183
|
expect(wrapper.vm.isActive).toBe(false)
|
|
176
|
-
wrapper.vm.toggle(wrapper.vm
|
|
184
|
+
wrapper.vm.toggle(wrapper.vm.$.uid)
|
|
177
185
|
await wrapper.vm.$nextTick()
|
|
178
186
|
expect(wrapper.vm.isActive).toBe(true)
|
|
179
187
|
})
|
|
180
188
|
|
|
181
|
-
it('should have the correct a11y attributes', () => {
|
|
189
|
+
it('should have the correct a11y attributes', async () => {
|
|
182
190
|
const wrapper = mountFunction()
|
|
183
191
|
const header = wrapper.find('.v-list-group__header')
|
|
184
192
|
|
|
185
|
-
expect(header.element.tabIndex).toBe(
|
|
193
|
+
expect(header.element.tabIndex).toBe(-1)
|
|
186
194
|
expect(header.element.getAttribute('aria-expanded')).toBe('false')
|
|
187
195
|
expect(header.element.getAttribute('role')).toBe('button')
|
|
188
196
|
|
|
189
|
-
wrapper.setData({ isActive: true })
|
|
197
|
+
await wrapper.setData({ isActive: true })
|
|
190
198
|
|
|
191
199
|
expect(header.element.getAttribute('aria-expanded')).toBe('true')
|
|
192
200
|
})
|