@dimailn/vuetify 2.7.2-alpha23 → 2.7.2-alpha25

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 (108) hide show
  1. package/dist/vuetify.js +280 -256
  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/VBadge/VBadge.js +17 -14
  6. package/es5/components/VBadge/VBadge.js.map +1 -1
  7. package/es5/components/VBtn/VBtn.js +16 -16
  8. package/es5/components/VBtn/VBtn.js.map +1 -1
  9. package/es5/components/VColorPicker/VColorPicker.js +18 -31
  10. package/es5/components/VColorPicker/VColorPicker.js.map +1 -1
  11. package/es5/components/VColorPicker/VColorPickerCanvas.js +45 -46
  12. package/es5/components/VColorPicker/VColorPickerCanvas.js.map +1 -1
  13. package/es5/components/VColorPicker/VColorPickerEdit.js +27 -26
  14. package/es5/components/VColorPicker/VColorPickerEdit.js.map +1 -1
  15. package/es5/components/VColorPicker/VColorPickerPreview.js +41 -30
  16. package/es5/components/VColorPicker/VColorPickerPreview.js.map +1 -1
  17. package/es5/components/VColorPicker/VColorPickerSwatches.js +13 -10
  18. package/es5/components/VColorPicker/VColorPickerSwatches.js.map +1 -1
  19. package/es5/components/VDataTable/VDataTable.js +7 -11
  20. package/es5/components/VDataTable/VDataTable.js.map +1 -1
  21. package/es5/components/VInput/VInput.js +24 -6
  22. package/es5/components/VInput/VInput.js.map +1 -1
  23. package/es5/components/VSelect/VSelectList.js +1 -1
  24. package/es5/components/VSelect/VSelectList.js.map +1 -1
  25. package/es5/components/VSlider/VSlider.js +23 -18
  26. package/es5/components/VSlider/VSlider.js.map +1 -1
  27. package/es5/components/VTooltip/VTooltip.js +3 -7
  28. package/es5/components/VTooltip/VTooltip.js.map +1 -1
  29. package/es5/framework.js +1 -1
  30. package/es5/mixins/activatable/index.js +2 -1
  31. package/es5/mixins/activatable/index.js.map +1 -1
  32. package/es5/mixins/bootable/index.js +1 -2
  33. package/es5/mixins/bootable/index.js.map +1 -1
  34. package/es5/mixins/mouse/index.js +10 -5
  35. package/es5/mixins/mouse/index.js.map +1 -1
  36. package/es5/mixins/selectable/index.js +3 -0
  37. package/es5/mixins/selectable/index.js.map +1 -1
  38. package/lib/components/VBadge/VBadge.js +14 -13
  39. package/lib/components/VBadge/VBadge.js.map +1 -1
  40. package/lib/components/VBtn/VBtn.js +18 -19
  41. package/lib/components/VBtn/VBtn.js.map +1 -1
  42. package/lib/components/VColorPicker/VColorPicker.js +29 -37
  43. package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
  44. package/lib/components/VColorPicker/VColorPickerCanvas.js +41 -43
  45. package/lib/components/VColorPicker/VColorPickerCanvas.js.map +1 -1
  46. package/lib/components/VColorPicker/VColorPickerEdit.js +25 -31
  47. package/lib/components/VColorPicker/VColorPickerEdit.js.map +1 -1
  48. package/lib/components/VColorPicker/VColorPickerPreview.js +45 -32
  49. package/lib/components/VColorPicker/VColorPickerPreview.js.map +1 -1
  50. package/lib/components/VColorPicker/VColorPickerSwatches.js +15 -9
  51. package/lib/components/VColorPicker/VColorPickerSwatches.js.map +1 -1
  52. package/lib/components/VDataTable/VDataTable.js +3 -4
  53. package/lib/components/VDataTable/VDataTable.js.map +1 -1
  54. package/lib/components/VInput/VInput.js +16 -4
  55. package/lib/components/VInput/VInput.js.map +1 -1
  56. package/lib/components/VSelect/VSelectList.js +2 -1
  57. package/lib/components/VSelect/VSelectList.js.map +1 -1
  58. package/lib/components/VSlider/VSlider.js +26 -21
  59. package/lib/components/VSlider/VSlider.js.map +1 -1
  60. package/lib/components/VTooltip/VTooltip.js +6 -9
  61. package/lib/components/VTooltip/VTooltip.js.map +1 -1
  62. package/lib/framework.js +1 -1
  63. package/lib/mixins/activatable/index.js +2 -1
  64. package/lib/mixins/activatable/index.js.map +1 -1
  65. package/lib/mixins/bootable/index.js +2 -4
  66. package/lib/mixins/bootable/index.js.map +1 -1
  67. package/lib/mixins/mouse/index.js +9 -5
  68. package/lib/mixins/mouse/index.js.map +1 -1
  69. package/lib/mixins/selectable/index.js +4 -0
  70. package/lib/mixins/selectable/index.js.map +1 -1
  71. package/package.json +1 -1
  72. package/src/components/VBadge/VBadge.ts +24 -25
  73. package/src/components/VBadge/__tests__/VBadge.spec.ts +47 -30
  74. package/src/components/VBadge/__tests__/__snapshots__/VBadge.spec.ts.snap +5 -5
  75. package/src/components/VBtn/VBtn.ts +18 -16
  76. package/src/components/VBtn/__tests__/VBtn.spec.ts +257 -242
  77. package/src/components/VBtn/__tests__/__snapshots__/VBtn.spec.ts.snap +13 -73
  78. package/src/components/VColorPicker/VColorPicker.ts +32 -35
  79. package/src/components/VColorPicker/VColorPickerCanvas.ts +44 -37
  80. package/src/components/VColorPicker/VColorPickerEdit.ts +37 -35
  81. package/src/components/VColorPicker/VColorPickerPreview.ts +48 -28
  82. package/src/components/VColorPicker/VColorPickerSwatches.ts +23 -12
  83. package/src/components/VColorPicker/__tests__/VColorPicker.spec.ts +47 -47
  84. package/src/components/VColorPicker/__tests__/VColorPickerCanvas.spec.ts +15 -13
  85. package/src/components/VColorPicker/__tests__/VColorPickerEdit.spec.ts +52 -50
  86. package/src/components/VColorPicker/__tests__/VColorPickerPreview.spec.ts +101 -30
  87. package/src/components/VColorPicker/__tests__/__snapshots__/VColorPicker.spec.ts.snap +200 -157
  88. package/src/components/VColorPicker/__tests__/__snapshots__/VColorPickerEdit.spec.ts.snap +28 -11
  89. package/src/components/VDataTable/VDataTable.ts +3 -3
  90. package/src/components/VInput/VInput.ts +12 -2
  91. package/src/components/VInput/__tests__/VInput.spec.ts +170 -234
  92. package/src/components/VInput/__tests__/__snapshots__/VInput.spec.ts.snap +50 -101
  93. package/src/components/VSelect/VSelectList.ts +1 -0
  94. package/src/components/VSkeletonLoader/__tests__/VSkeletonLoader.spec.ts +22 -15
  95. package/src/components/VSkeletonLoader/__tests__/__snapshots__/VSkeletonLoader.spec.ts.snap +60 -60
  96. package/src/components/VSlider/VSlider.ts +43 -27
  97. package/src/components/VSlider/__tests__/VSlider.spec.ts +188 -286
  98. package/src/components/VSlider/__tests__/__snapshots__/VSlider.spec.ts.snap +157 -246
  99. package/src/components/VTabs/__tests__/VTab.spec.ts +3 -3
  100. package/src/components/VTabs/__tests__/VTabsBar.spec.ts +2 -2
  101. package/src/components/VTooltip/VTooltip.ts +20 -20
  102. package/src/components/VTooltip/__tests__/VTooltip.spec.ts +60 -75
  103. package/src/mixins/activatable/index.ts +2 -1
  104. package/src/mixins/bootable/__tests__/bootable.spec.ts +17 -11
  105. package/src/mixins/bootable/index.ts +4 -3
  106. package/src/mixins/mouse/__tests__/mouse.spec.ts +54 -40
  107. package/src/mixins/mouse/index.ts +10 -6
  108. package/src/mixins/selectable/index.ts +4 -0
@@ -1,279 +1,215 @@
1
- import VInput from '../VInput'
2
- import {
3
- mount,
4
- MountOptions,
5
- Wrapper,
6
- } from '@vue/test-utils'
7
-
8
- describe('VInput.ts', () => {
9
- type Instance = InstanceType<typeof VInput>
10
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
1
+ import VInput from "../VInput";
2
+ import { mount, MountingOptions, VueWrapper } from "@vue/test-utils";
3
+ import { h } from "vue";
4
+
5
+ describe("VInput.ts", () => {
6
+ type Instance = InstanceType<typeof VInput>;
7
+ let mountFunction: (
8
+ options?: MountingOptions<Instance>
9
+ ) => VueWrapper<Instance>;
10
+
11
11
  beforeEach(() => {
12
- mountFunction = (options?: MountOptions<Instance>) => {
13
- return mount(VInput, {
14
- // https://github.com/vuejs/vue-test-utils/issues/1130
15
- sync: false,
16
- mocks: {
17
- $vuetify: {
18
- lang: {
19
- t: (val: string) => val,
20
- },
21
- },
22
- },
12
+ mountFunction = (options?: MountingOptions<Instance>) => {
13
+ const defaultOptions = {
14
+ global: {
15
+ mocks: {
16
+ // Мокаем только необходимые свойства Vuetify
17
+ $vuetify: {
18
+ lang: {
19
+ t: (val: string) => val
20
+ },
21
+ icons: {
22
+ component: "mdi"
23
+ }
24
+ }
25
+ }
26
+ }
27
+ };
28
+
29
+ // Объединяем опции правильно
30
+ const mergedOptions = {
31
+ ...defaultOptions,
23
32
  ...options,
24
- })
25
- }
26
- })
27
-
28
- it('should have hint', () => {
29
- const wrapper = mountFunction({
30
- propsData: {
31
- hint: 'foo',
32
- },
33
- })
34
-
35
- expect(wrapper.vm.hasHint).toBe(false)
36
- wrapper.setProps({ persistentHint: true })
37
- expect(wrapper.vm.hasHint).toBe(true)
38
- wrapper.setProps({ persistentHint: false })
39
- expect(wrapper.vm.hasHint).toBe(false)
40
- wrapper.setData({ isFocused: true })
41
- expect(wrapper.vm.hasHint).toBe(true)
42
- })
43
-
44
- it('should emit an input update', () => {
45
- const wrapper = mountFunction()
46
-
47
- const input = jest.fn()
48
- wrapper.vm.$on('input', input)
49
-
50
- expect(wrapper.vm.lazyValue).toBeUndefined()
51
- wrapper.vm.internalValue = 'foo'
52
- expect(input).toHaveBeenCalledWith('foo')
53
- expect(wrapper.vm.lazyValue).toBe('foo')
54
- })
55
-
56
- it('should generate append and prepend slots', () => {
57
- const el = slot => ({
58
- render: h => h('div', slot),
59
- })
60
- const wrapper = mountFunction({
61
- slots: { append: [el('append')] },
62
- })
63
- const wrapper2 = mountFunction({
64
- slots: { prepend: [el('prepend')] },
65
- })
33
+ global: {
34
+ ...defaultOptions.global,
35
+ ...options?.global
36
+ }
37
+ };
66
38
 
67
- expect(wrapper.html()).toMatchSnapshot()
68
- expect(wrapper2.html()).toMatchSnapshot()
69
- })
39
+ return mount(VInput, mergedOptions);
40
+ };
41
+ });
70
42
 
71
- it('should generate an icon and match snapshot', async () => {
43
+ it("should have hint", async () => {
44
+ const wrapper = mountFunction({
45
+ props: {
46
+ hint: "foo"
47
+ }
48
+ });
49
+
50
+ expect(wrapper.vm.hasHint).toBe(false);
51
+ await wrapper.setProps({ persistentHint: true });
52
+ expect(wrapper.vm.hasHint).toBe(true);
53
+ await wrapper.setProps({ persistentHint: false });
54
+ expect(wrapper.vm.hasHint).toBe(false);
55
+ });
56
+
57
+ it("should update lazyValue when value is updated", async () => {
72
58
  const wrapper = mountFunction({
73
- propsData: {
74
- prependIcon: 'list',
75
- },
76
- })
59
+ props: {
60
+ modelValue: "foo"
61
+ }
62
+ });
77
63
 
78
- expect(wrapper.html()).toMatchSnapshot()
64
+ expect(wrapper.vm.lazyValue).toBe("foo");
79
65
 
80
- wrapper.setProps({
81
- prependIcon: undefined,
82
- appendIcon: 'list',
83
- })
66
+ await wrapper.setProps({ modelValue: "bar" });
84
67
 
85
- await wrapper.vm.$nextTick()
68
+ expect(wrapper.vm.lazyValue).toBe("bar");
69
+ });
86
70
 
87
- expect(wrapper.html()).toMatchSnapshot()
88
- })
89
-
90
- it('should not generate input details', () => {
71
+ it("should generate append and prepend slots", () => {
72
+ const el = (slot: string) => h("div", slot);
91
73
  const wrapper = mountFunction({
92
- propsData: {
93
- hideDetails: true,
94
- },
95
- })
74
+ slots: {
75
+ append: () => [el("append")]
76
+ }
77
+ });
78
+ const wrapper2 = mountFunction({
79
+ slots: {
80
+ prepend: () => [el("prepend")]
81
+ }
82
+ });
96
83
 
97
- expect(wrapper.vm.genMessages()).toBeNull()
98
- expect(wrapper.html()).toMatchSnapshot()
99
- })
84
+ expect(wrapper.html()).toMatchSnapshot();
85
+ expect(wrapper2.html()).toMatchSnapshot();
86
+ });
100
87
 
101
- it('should invoke callback', () => {
102
- const cb = jest.fn()
103
- const wrapper = mountFunction({
104
- propsData: {
105
- prependIcon: 'list',
106
- appendIcon: 'search',
107
- },
108
- listeners: {
109
- 'click:prepend': cb,
110
- 'click:append': cb,
111
- },
112
- })
113
-
114
- const click = jest.fn()
115
- wrapper.vm.$on('click', click)
116
-
117
- const prepend = wrapper.findAll('.v-icon').at(0)
118
- const append = wrapper.findAll('.v-icon').at(1)
119
- const slot = wrapper.find('.v-input__slot')
120
-
121
- prepend.trigger('click')
122
- expect(cb).toHaveBeenCalledTimes(1)
123
- append.trigger('click')
124
- expect(cb).toHaveBeenCalledTimes(2)
125
- expect(click).not.toHaveBeenCalled()
126
-
127
- slot.trigger('click')
128
- expect(click).toHaveBeenCalled()
129
- })
130
-
131
- it('should accept a custom height', async () => {
132
- const wrapper = mountFunction()
133
-
134
- const inputWrapper = wrapper.find('.v-input__slot')
135
- expect(inputWrapper.element.style.height).toBe('')
136
- expect(wrapper.vm.height).toBeUndefined()
137
-
138
- wrapper.setProps({ height: 10 })
139
- await wrapper.vm.$nextTick()
140
- expect(inputWrapper.element.style.height).toBe('10px')
141
- wrapper.setProps({ height: '20px' })
142
- await wrapper.vm.$nextTick()
143
- expect(inputWrapper.element.style.height).toBe('20px')
144
- })
145
-
146
- it('should update lazyValue when value is updated', async () => {
88
+ it("should generate an icon and match snapshot", async () => {
147
89
  const wrapper = mountFunction({
148
- propsData: {
149
- value: 'foo',
150
- },
151
- })
90
+ props: {
91
+ prependIcon: "list"
92
+ }
93
+ });
152
94
 
153
- expect(wrapper.vm.lazyValue).toBe('foo')
95
+ expect(wrapper.html()).toMatchSnapshot();
154
96
 
155
- wrapper.setProps({ value: 'bar' })
156
- await wrapper.vm.$nextTick()
97
+ await wrapper.setProps({
98
+ prependIcon: undefined,
99
+ appendIcon: "list"
100
+ });
157
101
 
158
- expect(wrapper.vm.lazyValue).toBe('bar')
159
- })
102
+ expect(wrapper.html()).toMatchSnapshot();
103
+ });
160
104
 
161
- it('should call the correct event for different click locations', () => {
162
- const onClick = jest.fn()
163
- const onMouseDown = jest.fn()
164
- const onMouseUp = jest.fn()
105
+ it("should not generate input details", () => {
165
106
  const wrapper = mountFunction({
166
- methods: {
167
- onClick,
168
- onMouseDown,
169
- onMouseUp,
170
- },
171
- })
172
-
173
- const slot = wrapper.find('.v-input__slot')
174
-
175
- wrapper.trigger('click')
176
- wrapper.trigger('mousedown')
177
- wrapper.trigger('mouseup')
178
- slot.trigger('click')
179
- slot.trigger('mousedown')
180
- slot.trigger('mouseup')
181
-
182
- expect(onClick).toHaveBeenCalledTimes(1)
183
- expect(onMouseDown).toHaveBeenCalledTimes(1)
184
- expect(onMouseUp).toHaveBeenCalledTimes(1)
185
- })
186
-
187
- it('should be in an error state', async () => {
107
+ props: {
108
+ hideDetails: true
109
+ }
110
+ });
111
+
112
+ expect(wrapper.vm.genMessages()).toBeNull();
113
+ expect(wrapper.html()).toMatchSnapshot();
114
+ });
115
+
116
+ it("should accept a custom height", async () => {
117
+ const wrapper = mountFunction();
118
+
119
+ const inputWrapper = wrapper.find(".v-input__slot");
120
+ expect(inputWrapper.element?.getAttribute("style")).toBe(null);
121
+ expect(wrapper.vm.height).toBeUndefined();
122
+
123
+ await wrapper.setProps({ height: 10 });
124
+ expect(inputWrapper.element?.getAttribute("style")).toContain(
125
+ "height: 10px"
126
+ );
127
+ await wrapper.setProps({ height: "20px" });
128
+ expect(inputWrapper.element?.getAttribute("style")).toContain(
129
+ "height: 20px"
130
+ );
131
+ });
132
+
133
+ it("should be in an error state", async () => {
188
134
  const wrapper = mountFunction({
189
- propsData: { error: true },
190
- })
135
+ props: { error: true }
136
+ });
191
137
 
192
- expect(wrapper.html()).toMatchSnapshot()
138
+ expect(wrapper.html()).toMatchSnapshot();
193
139
 
194
- wrapper.setProps({ errorMessages: 'required', error: false })
195
- await wrapper.vm.$nextTick()
196
- expect(wrapper.html()).toMatchSnapshot()
197
- })
140
+ await wrapper.setProps({ errorMessages: "required", error: false });
141
+ expect(wrapper.html()).toMatchSnapshot();
142
+ });
198
143
 
199
- it('should hide messages if no messages and hide-details is auto', () => {
144
+ it("should hide messages if no messages and hide-details is auto", async () => {
200
145
  const wrapper = mountFunction({
201
- propsData: {
202
- hideDetails: 'auto',
203
- },
204
- })
146
+ props: {
147
+ hideDetails: "auto"
148
+ }
149
+ });
205
150
 
206
- expect(wrapper.vm.genMessages()).toBeNull()
151
+ expect(wrapper.vm.genMessages()).toBeNull();
207
152
 
208
- wrapper.setProps({ error: true })
209
- expect(wrapper.vm.genMessages()).toBeNull()
153
+ await wrapper.setProps({ error: true });
154
+ expect(wrapper.vm.genMessages()).toBeNull();
210
155
 
211
- wrapper.setProps({ errorMessages: 'required' })
212
- expect(wrapper.vm.genMessages()).not.toBeNull()
213
- })
156
+ await wrapper.setProps({ errorMessages: "required" });
157
+ expect(wrapper.vm.genMessages()).not.toBeNull();
158
+ });
214
159
 
215
- it('should be disabled', () => {
216
- const wrapper = mountFunction()
160
+ it("should be disabled", async () => {
161
+ const wrapper = mountFunction();
217
162
 
218
- expect(wrapper.vm.isInteractive).toBe(true)
163
+ expect(wrapper.vm.isInteractive).toBe(true);
219
164
 
220
- wrapper.setProps({ disabled: true })
165
+ await wrapper.setProps({ disabled: true });
221
166
 
222
- expect(wrapper.vm.isInteractive).toBe(false)
167
+ expect(wrapper.vm.isInteractive).toBe(false);
223
168
 
224
- wrapper.setProps({
169
+ await wrapper.setProps({
225
170
  disabled: false,
226
- readonly: true,
227
- })
171
+ readonly: true
172
+ });
228
173
 
229
- expect(wrapper.vm.isInteractive).toBe(false)
174
+ expect(wrapper.vm.isInteractive).toBe(false);
230
175
 
231
- wrapper.setProps({ readonly: false })
176
+ await wrapper.setProps({ readonly: false });
232
177
 
233
- expect(wrapper.vm.isInteractive).toBe(true)
234
- })
178
+ expect(wrapper.vm.isInteractive).toBe(true);
179
+ });
235
180
 
236
- it('should render a label', () => {
181
+ it("should render a label", () => {
237
182
  const wrapper = mountFunction({
238
- propsData: { label: 'foo' },
239
- })
240
-
241
- expect(wrapper.vm.hasLabel).toBe(true)
242
-
243
- expect(wrapper.html()).toMatchSnapshot()
244
-
245
- const wrapper2 = mountFunction({
246
- slots: {
247
- label: [{ render: h => h('div', 'foo') }],
248
- },
249
- })
183
+ props: { label: "foo" }
184
+ });
250
185
 
251
- expect(wrapper2.html()).toMatchSnapshot()
252
- })
186
+ expect(wrapper.vm.hasLabel).toBe(true);
187
+ expect(wrapper.html()).toMatchSnapshot();
188
+ });
253
189
 
254
- it('should apply theme to label, counter, messages and icons', () => {
190
+ it("should apply theme to label, counter, messages and icons", () => {
255
191
  const wrapper = mountFunction({
256
- propsData: {
257
- label: 'foo',
258
- hint: 'bar',
192
+ props: {
193
+ label: "foo",
194
+ hint: "bar",
259
195
  persistentHint: true,
260
196
  light: true,
261
- prependIcon: 'prepend',
262
- appendIcon: 'append',
263
- },
264
- })
197
+ prependIcon: "prepend",
198
+ appendIcon: "append"
199
+ }
200
+ });
265
201
 
266
- expect(wrapper.html()).toMatchSnapshot()
267
- })
202
+ expect(wrapper.html()).toMatchSnapshot();
203
+ });
268
204
 
269
- it('should not apply attrs to element', () => {
205
+ it("should apply attrs to root element", () => {
270
206
  const wrapper = mountFunction({
271
- propsData: {
272
- foo: 'bar',
273
- },
274
- })
275
-
276
- expect(wrapper.html()).toMatchSnapshot()
277
- expect(wrapper.attributes()).not.toHaveProperty('foobar')
278
- })
279
- })
207
+ props: {
208
+ foo: "bar"
209
+ }
210
+ });
211
+
212
+ expect(wrapper.html()).toMatchSnapshot();
213
+ expect(wrapper.attributes()).toHaveProperty("foo", "bar");
214
+ });
215
+ });