@dimailn/vuetify 2.7.2-alpha24 → 2.7.2-alpha26

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 (244) hide show
  1. package/dist/vuetify.js +583 -388
  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/VAppBar/VAppBarNavIcon.js +5 -1
  6. package/es5/components/VAppBar/VAppBarNavIcon.js.map +1 -1
  7. package/es5/components/VBanner/VBanner.js +15 -6
  8. package/es5/components/VBanner/VBanner.js.map +1 -1
  9. package/es5/components/VBreadcrumbs/VBreadcrumbs.js +18 -6
  10. package/es5/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
  11. package/es5/components/VBtn/VBtn.js +19 -15
  12. package/es5/components/VBtn/VBtn.js.map +1 -1
  13. package/es5/components/VCarousel/VCarousel.js +10 -4
  14. package/es5/components/VCarousel/VCarousel.js.map +1 -1
  15. package/es5/components/VCarousel/VCarouselItem.js +7 -3
  16. package/es5/components/VCarousel/VCarouselItem.js.map +1 -1
  17. package/es5/components/VCheckbox/VCheckbox.js +5 -1
  18. package/es5/components/VCheckbox/VCheckbox.js.map +1 -1
  19. package/es5/components/VColorPicker/VColorPicker.js +18 -31
  20. package/es5/components/VColorPicker/VColorPicker.js.map +1 -1
  21. package/es5/components/VColorPicker/VColorPickerCanvas.js +45 -46
  22. package/es5/components/VColorPicker/VColorPickerCanvas.js.map +1 -1
  23. package/es5/components/VColorPicker/VColorPickerEdit.js +27 -26
  24. package/es5/components/VColorPicker/VColorPickerEdit.js.map +1 -1
  25. package/es5/components/VColorPicker/VColorPickerPreview.js +41 -30
  26. package/es5/components/VColorPicker/VColorPickerPreview.js.map +1 -1
  27. package/es5/components/VColorPicker/VColorPickerSwatches.js +13 -10
  28. package/es5/components/VColorPicker/VColorPickerSwatches.js.map +1 -1
  29. package/es5/components/VDataIterator/VDataFooter.js +5 -1
  30. package/es5/components/VDataIterator/VDataFooter.js.map +1 -1
  31. package/es5/components/VDataTable/VDataTable.js +28 -18
  32. package/es5/components/VDataTable/VDataTable.js.map +1 -1
  33. package/es5/components/VDataTable/VDataTableHeader.js +2 -6
  34. package/es5/components/VDataTable/VDataTableHeader.js.map +1 -1
  35. package/es5/components/VDataTable/VEditDialog.js +6 -2
  36. package/es5/components/VDataTable/VEditDialog.js.map +1 -1
  37. package/es5/components/VDataTable/mixins/header.js +5 -1
  38. package/es5/components/VDataTable/mixins/header.js.map +1 -1
  39. package/es5/components/VDatePicker/VDatePickerHeader.js +8 -2
  40. package/es5/components/VDatePicker/VDatePickerHeader.js.map +1 -1
  41. package/es5/components/VDatePicker/VDatePickerTitle.js +13 -5
  42. package/es5/components/VDatePicker/VDatePickerTitle.js.map +1 -1
  43. package/es5/components/VDatePicker/mixins/date-picker-table.js +5 -3
  44. package/es5/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
  45. package/es5/components/VDialog/VDialog.js +16 -12
  46. package/es5/components/VDialog/VDialog.js.map +1 -1
  47. package/es5/components/VExpansionPanel/VExpansionPanelContent.js +11 -9
  48. package/es5/components/VExpansionPanel/VExpansionPanelContent.js.map +1 -1
  49. package/es5/components/VExpansionPanel/VExpansionPanelHeader.js +15 -9
  50. package/es5/components/VExpansionPanel/VExpansionPanelHeader.js.map +1 -1
  51. package/es5/components/VImg/VImg.js +6 -2
  52. package/es5/components/VImg/VImg.js.map +1 -1
  53. package/es5/components/VInput/VInput.js +28 -8
  54. package/es5/components/VInput/VInput.js.map +1 -1
  55. package/es5/components/VList/VListGroup.js +27 -9
  56. package/es5/components/VList/VListGroup.js.map +1 -1
  57. package/es5/components/VList/VListItem.js +5 -1
  58. package/es5/components/VList/VListItem.js.map +1 -1
  59. package/es5/components/VMessages/VMessages.js +5 -1
  60. package/es5/components/VMessages/VMessages.js.map +1 -1
  61. package/es5/components/VOverflowBtn/VOverflowBtn.js +3 -1
  62. package/es5/components/VOverflowBtn/VOverflowBtn.js.map +1 -1
  63. package/es5/components/VPagination/VPagination.js +3 -1
  64. package/es5/components/VPagination/VPagination.js.map +1 -1
  65. package/es5/components/VPicker/VPicker.js +5 -1
  66. package/es5/components/VPicker/VPicker.js.map +1 -1
  67. package/es5/components/VRadioGroup/VRadio.js +10 -2
  68. package/es5/components/VRadioGroup/VRadio.js.map +1 -1
  69. package/es5/components/VSelect/VSelect.js +6 -2
  70. package/es5/components/VSelect/VSelect.js.map +1 -1
  71. package/es5/components/VSelect/VSelectList.js +17 -9
  72. package/es5/components/VSelect/VSelectList.js.map +1 -1
  73. package/es5/components/VSlideGroup/VSlideGroup.js +26 -18
  74. package/es5/components/VSlideGroup/VSlideGroup.js.map +1 -1
  75. package/es5/components/VSlider/VSlider.js +36 -27
  76. package/es5/components/VSlider/VSlider.js.map +1 -1
  77. package/es5/components/VStepper/VStepperContent.js +3 -1
  78. package/es5/components/VStepper/VStepperContent.js.map +1 -1
  79. package/es5/components/VSwitch/VSwitch.js +10 -6
  80. package/es5/components/VSwitch/VSwitch.js.map +1 -1
  81. package/es5/components/VTabs/VTabs.js +6 -2
  82. package/es5/components/VTabs/VTabs.js.map +1 -1
  83. package/es5/components/VTextField/VTextField.js +7 -3
  84. package/es5/components/VTextField/VTextField.js.map +1 -1
  85. package/es5/components/VTooltip/VTooltip.js +6 -8
  86. package/es5/components/VTooltip/VTooltip.js.map +1 -1
  87. package/es5/components/VTreeview/VTreeviewNode.js +11 -3
  88. package/es5/components/VTreeview/VTreeviewNode.js.map +1 -1
  89. package/es5/components/transitions/createTransition.js +8 -2
  90. package/es5/components/transitions/createTransition.js.map +1 -1
  91. package/es5/framework.js +1 -1
  92. package/es5/mixins/picker/index.js +13 -3
  93. package/es5/mixins/picker/index.js.map +1 -1
  94. package/lib/components/VAppBar/VAppBarNavIcon.js +1 -1
  95. package/lib/components/VAppBar/VAppBarNavIcon.js.map +1 -1
  96. package/lib/components/VBanner/VBanner.js +3 -3
  97. package/lib/components/VBanner/VBanner.js.map +1 -1
  98. package/lib/components/VBreadcrumbs/VBreadcrumbs.js +2 -2
  99. package/lib/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
  100. package/lib/components/VBtn/VBtn.js +20 -19
  101. package/lib/components/VBtn/VBtn.js.map +1 -1
  102. package/lib/components/VCarousel/VCarousel.js +3 -3
  103. package/lib/components/VCarousel/VCarousel.js.map +1 -1
  104. package/lib/components/VCarousel/VCarouselItem.js +1 -1
  105. package/lib/components/VCarousel/VCarouselItem.js.map +1 -1
  106. package/lib/components/VCheckbox/VCheckbox.js +1 -1
  107. package/lib/components/VCheckbox/VCheckbox.js.map +1 -1
  108. package/lib/components/VColorPicker/VColorPicker.js +29 -37
  109. package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
  110. package/lib/components/VColorPicker/VColorPickerCanvas.js +41 -43
  111. package/lib/components/VColorPicker/VColorPickerCanvas.js.map +1 -1
  112. package/lib/components/VColorPicker/VColorPickerEdit.js +25 -31
  113. package/lib/components/VColorPicker/VColorPickerEdit.js.map +1 -1
  114. package/lib/components/VColorPicker/VColorPickerPreview.js +45 -32
  115. package/lib/components/VColorPicker/VColorPickerPreview.js.map +1 -1
  116. package/lib/components/VColorPicker/VColorPickerSwatches.js +15 -9
  117. package/lib/components/VColorPicker/VColorPickerSwatches.js.map +1 -1
  118. package/lib/components/VDataIterator/VDataFooter.js +1 -1
  119. package/lib/components/VDataIterator/VDataFooter.js.map +1 -1
  120. package/lib/components/VDataTable/VDataTable.js +8 -9
  121. package/lib/components/VDataTable/VDataTable.js.map +1 -1
  122. package/lib/components/VDataTable/VDataTableHeader.js +3 -6
  123. package/lib/components/VDataTable/VDataTableHeader.js.map +1 -1
  124. package/lib/components/VDataTable/VEditDialog.js +2 -2
  125. package/lib/components/VDataTable/VEditDialog.js.map +1 -1
  126. package/lib/components/VDataTable/mixins/header.js +1 -1
  127. package/lib/components/VDataTable/mixins/header.js.map +1 -1
  128. package/lib/components/VDatePicker/VDatePickerHeader.js +2 -2
  129. package/lib/components/VDatePicker/VDatePickerHeader.js.map +1 -1
  130. package/lib/components/VDatePicker/VDatePickerTitle.js +2 -2
  131. package/lib/components/VDatePicker/VDatePickerTitle.js.map +1 -1
  132. package/lib/components/VDatePicker/mixins/date-picker-table.js +1 -1
  133. package/lib/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
  134. package/lib/components/VDialog/VDialog.js +2 -2
  135. package/lib/components/VDialog/VDialog.js.map +1 -1
  136. package/lib/components/VExpansionPanel/VExpansionPanelContent.js +1 -1
  137. package/lib/components/VExpansionPanel/VExpansionPanelContent.js.map +1 -1
  138. package/lib/components/VExpansionPanel/VExpansionPanelHeader.js +2 -2
  139. package/lib/components/VExpansionPanel/VExpansionPanelHeader.js.map +1 -1
  140. package/lib/components/VImg/VImg.js +2 -2
  141. package/lib/components/VImg/VImg.js.map +1 -1
  142. package/lib/components/VInput/VInput.js +14 -6
  143. package/lib/components/VInput/VInput.js.map +1 -1
  144. package/lib/components/VList/VListGroup.js +5 -5
  145. package/lib/components/VList/VListGroup.js.map +1 -1
  146. package/lib/components/VList/VListItem.js +3 -1
  147. package/lib/components/VList/VListItem.js.map +1 -1
  148. package/lib/components/VMessages/VMessages.js +1 -1
  149. package/lib/components/VMessages/VMessages.js.map +1 -1
  150. package/lib/components/VOverflowBtn/VOverflowBtn.js +1 -1
  151. package/lib/components/VOverflowBtn/VOverflowBtn.js.map +1 -1
  152. package/lib/components/VPagination/VPagination.js +1 -1
  153. package/lib/components/VPagination/VPagination.js.map +1 -1
  154. package/lib/components/VPicker/VPicker.js +1 -1
  155. package/lib/components/VPicker/VPicker.js.map +1 -1
  156. package/lib/components/VRadioGroup/VRadio.js +2 -2
  157. package/lib/components/VRadioGroup/VRadio.js.map +1 -1
  158. package/lib/components/VSelect/VSelect.js +2 -2
  159. package/lib/components/VSelect/VSelect.js.map +1 -1
  160. package/lib/components/VSelect/VSelectList.js +2 -2
  161. package/lib/components/VSelect/VSelectList.js.map +1 -1
  162. package/lib/components/VSlideGroup/VSlideGroup.js +3 -3
  163. package/lib/components/VSlideGroup/VSlideGroup.js.map +1 -1
  164. package/lib/components/VSlider/VSlider.js +26 -21
  165. package/lib/components/VSlider/VSlider.js.map +1 -1
  166. package/lib/components/VStepper/VStepperContent.js +1 -1
  167. package/lib/components/VStepper/VStepperContent.js.map +1 -1
  168. package/lib/components/VSwitch/VSwitch.js +1 -1
  169. package/lib/components/VSwitch/VSwitch.js.map +1 -1
  170. package/lib/components/VTabs/VTabs.js +2 -2
  171. package/lib/components/VTabs/VTabs.js.map +1 -1
  172. package/lib/components/VTextField/VTextField.js +1 -1
  173. package/lib/components/VTextField/VTextField.js.map +1 -1
  174. package/lib/components/VTooltip/VTooltip.js +7 -10
  175. package/lib/components/VTooltip/VTooltip.js.map +1 -1
  176. package/lib/components/VTreeview/VTreeviewNode.js +3 -3
  177. package/lib/components/VTreeview/VTreeviewNode.js.map +1 -1
  178. package/lib/components/transitions/createTransition.js +2 -2
  179. package/lib/components/transitions/createTransition.js.map +1 -1
  180. package/lib/framework.js +1 -1
  181. package/lib/mixins/picker/index.js +5 -3
  182. package/lib/mixins/picker/index.js.map +1 -1
  183. package/package.json +1 -1
  184. package/src/components/VAppBar/VAppBarNavIcon.ts +1 -1
  185. package/src/components/VBanner/VBanner.ts +3 -3
  186. package/src/components/VBreadcrumbs/VBreadcrumbs.ts +2 -2
  187. package/src/components/VBtn/VBtn.ts +24 -16
  188. package/src/components/VBtn/__tests__/VBtn.spec.ts +257 -242
  189. package/src/components/VBtn/__tests__/__snapshots__/VBtn.spec.ts.snap +13 -73
  190. package/src/components/VCarousel/VCarousel.ts +3 -3
  191. package/src/components/VCarousel/VCarouselItem.ts +1 -1
  192. package/src/components/VCheckbox/VCheckbox.ts +1 -1
  193. package/src/components/VColorPicker/VColorPicker.ts +32 -35
  194. package/src/components/VColorPicker/VColorPickerCanvas.ts +44 -37
  195. package/src/components/VColorPicker/VColorPickerEdit.ts +37 -35
  196. package/src/components/VColorPicker/VColorPickerPreview.ts +48 -28
  197. package/src/components/VColorPicker/VColorPickerSwatches.ts +23 -12
  198. package/src/components/VColorPicker/__tests__/VColorPicker.spec.ts +47 -47
  199. package/src/components/VColorPicker/__tests__/VColorPickerCanvas.spec.ts +15 -13
  200. package/src/components/VColorPicker/__tests__/VColorPickerEdit.spec.ts +52 -50
  201. package/src/components/VColorPicker/__tests__/VColorPickerPreview.spec.ts +101 -30
  202. package/src/components/VColorPicker/__tests__/__snapshots__/VColorPicker.spec.ts.snap +200 -157
  203. package/src/components/VColorPicker/__tests__/__snapshots__/VColorPickerEdit.spec.ts.snap +28 -11
  204. package/src/components/VDataIterator/VDataFooter.ts +1 -1
  205. package/src/components/VDataTable/VDataTable.ts +8 -8
  206. package/src/components/VDataTable/VDataTableHeader.ts +2 -4
  207. package/src/components/VDataTable/VEditDialog.ts +2 -2
  208. package/src/components/VDataTable/mixins/header.ts +1 -1
  209. package/src/components/VDatePicker/VDatePickerHeader.ts +3 -3
  210. package/src/components/VDatePicker/VDatePickerTitle.ts +2 -2
  211. package/src/components/VDatePicker/mixins/date-picker-table.ts +1 -1
  212. package/src/components/VDialog/VDialog.ts +2 -2
  213. package/src/components/VExpansionPanel/VExpansionPanelContent.ts +1 -1
  214. package/src/components/VExpansionPanel/VExpansionPanelHeader.ts +2 -2
  215. package/src/components/VImg/VImg.ts +2 -2
  216. package/src/components/VInput/VInput.ts +10 -4
  217. package/src/components/VInput/__tests__/VInput.spec.ts +170 -234
  218. package/src/components/VInput/__tests__/__snapshots__/VInput.spec.ts.snap +50 -101
  219. package/src/components/VList/VListGroup.ts +5 -5
  220. package/src/components/VList/VListItem.ts +7 -4
  221. package/src/components/VMessages/VMessages.ts +1 -1
  222. package/src/components/VOverflowBtn/VOverflowBtn.ts +1 -1
  223. package/src/components/VPagination/VPagination.ts +1 -1
  224. package/src/components/VPicker/VPicker.ts +1 -1
  225. package/src/components/VRadioGroup/VRadio.ts +2 -2
  226. package/src/components/VSelect/VSelect.ts +2 -2
  227. package/src/components/VSelect/VSelectList.ts +3 -3
  228. package/src/components/VSkeletonLoader/__tests__/VSkeletonLoader.spec.ts +22 -15
  229. package/src/components/VSkeletonLoader/__tests__/__snapshots__/VSkeletonLoader.spec.ts.snap +60 -60
  230. package/src/components/VSlideGroup/VSlideGroup.ts +3 -3
  231. package/src/components/VSlider/VSlider.ts +44 -28
  232. package/src/components/VSlider/__tests__/VSlider.spec.ts +188 -286
  233. package/src/components/VSlider/__tests__/__snapshots__/VSlider.spec.ts.snap +157 -246
  234. package/src/components/VStepper/VStepperContent.ts +1 -1
  235. package/src/components/VSwitch/VSwitch.ts +1 -1
  236. package/src/components/VTabs/VTabs.ts +2 -2
  237. package/src/components/VTabs/__tests__/VTab.spec.ts +3 -3
  238. package/src/components/VTabs/__tests__/VTabsBar.spec.ts +2 -2
  239. package/src/components/VTextField/VTextField.ts +1 -1
  240. package/src/components/VTooltip/VTooltip.ts +21 -21
  241. package/src/components/VTooltip/__tests__/VTooltip.spec.ts +60 -75
  242. package/src/components/VTreeview/VTreeviewNode.ts +3 -3
  243. package/src/components/transitions/createTransition.ts +2 -2
  244. package/src/mixins/picker/index.ts +4 -4
@@ -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
+ });