@dimailn/vuetify 2.7.2-alpha21 → 2.7.2-alpha23

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 (79) hide show
  1. package/dist/vuetify.js +141 -72
  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/VForm/VForm.js +44 -30
  6. package/es5/components/VForm/VForm.js.map +1 -1
  7. package/es5/components/VOverlay/VOverlay.js +2 -3
  8. package/es5/components/VOverlay/VOverlay.js.map +1 -1
  9. package/es5/components/VProgressCircular/VProgressCircular.js +5 -3
  10. package/es5/components/VProgressCircular/VProgressCircular.js.map +1 -1
  11. package/es5/components/VProgressLinear/VProgressLinear.js +41 -19
  12. package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
  13. package/es5/components/VTabs/VTabsBar.js.map +1 -1
  14. package/es5/components/VVirtualScroll/VVirtualScroll.js +15 -16
  15. package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  16. package/es5/components/VWindow/VWindow.js +13 -5
  17. package/es5/components/VWindow/VWindow.js.map +1 -1
  18. package/es5/components/VWindow/VWindowItem.js +9 -5
  19. package/es5/components/VWindow/VWindowItem.js.map +1 -1
  20. package/es5/framework.js +1 -1
  21. package/es5/mixins/overlayable/index.js.map +1 -1
  22. package/es5/mixins/validatable/index.js +8 -5
  23. package/es5/mixins/validatable/index.js.map +1 -1
  24. package/lib/components/VForm/VForm.js +40 -26
  25. package/lib/components/VForm/VForm.js.map +1 -1
  26. package/lib/components/VOverlay/VOverlay.js +1 -2
  27. package/lib/components/VOverlay/VOverlay.js.map +1 -1
  28. package/lib/components/VProgressCircular/VProgressCircular.js +5 -3
  29. package/lib/components/VProgressCircular/VProgressCircular.js.map +1 -1
  30. package/lib/components/VProgressLinear/VProgressLinear.js +35 -17
  31. package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
  32. package/lib/components/VTabs/VTabsBar.js.map +1 -1
  33. package/lib/components/VVirtualScroll/VVirtualScroll.js +8 -11
  34. package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  35. package/lib/components/VWindow/VWindow.js +7 -3
  36. package/lib/components/VWindow/VWindow.js.map +1 -1
  37. package/lib/components/VWindow/VWindowItem.js +3 -1
  38. package/lib/components/VWindow/VWindowItem.js.map +1 -1
  39. package/lib/framework.js +1 -1
  40. package/lib/mixins/overlayable/index.js.map +1 -1
  41. package/lib/mixins/validatable/index.js +8 -4
  42. package/lib/mixins/validatable/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/components/VAvatar/__tests__/VAvatar.spec.ts +72 -10
  45. package/src/components/VForm/VForm.ts +61 -35
  46. package/src/components/VForm/__tests__/VForm.spec.ts +100 -80
  47. package/src/components/VOverlay/VOverlay.ts +1 -1
  48. package/src/components/VOverlay/__tests__/VOverlay.spec.ts +6 -6
  49. package/src/components/VProgressCircular/VProgressCircular.ts +6 -5
  50. package/src/components/VProgressCircular/__tests__/VProgressCircular.spec.ts +28 -21
  51. package/src/components/VProgressCircular/__tests__/__snapshots__/VProgressCircular.spec.ts.snap +62 -62
  52. package/src/components/VProgressLinear/VProgressLinear.ts +42 -22
  53. package/src/components/VProgressLinear/__tests__/VProgressLinear.spec.ts +378 -71
  54. package/src/components/VProgressLinear/__tests__/__snapshots__/VProgressLinear.spec.ts.snap +53 -79
  55. package/src/components/VSheet/__tests__/VSheet.spec.ts +5 -5
  56. package/src/components/VTabs/VTabsBar.ts +7 -5
  57. package/src/components/VVirtualScroll/VVirtualScroll.ts +14 -13
  58. package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +26 -19
  59. package/src/components/VWindow/VWindow.ts +9 -5
  60. package/src/components/VWindow/VWindowItem.ts +3 -1
  61. package/src/components/VWindow/__tests__/VWindow.spec.ts +226 -185
  62. package/src/components/VWindow/__tests__/VWindowItem.spec.ts +162 -132
  63. package/src/mixins/applicationable/__tests__/applicationable.spec.ts +31 -27
  64. package/src/mixins/colorable/__tests__/colorable.spec.ts +9 -6
  65. package/src/mixins/elevatable/__tests__/elevatable.spec.ts +14 -13
  66. package/src/mixins/intersectable/__tests__/intersectable.spec.ts +35 -29
  67. package/src/mixins/menuable/__tests__/menuable.spec.ts +76 -33
  68. package/src/mixins/mobile/__tests__/mobile.spec.ts +9 -6
  69. package/src/mixins/overlayable/__tests__/overlayable.spec.ts +32 -24
  70. package/src/mixins/overlayable/index.ts +1 -1
  71. package/src/mixins/proxyable/__tests__/proxyable.spec.ts +18 -17
  72. package/src/mixins/registrable/__tests__/registrable.spec.ts +31 -0
  73. package/src/mixins/rippleable/__tests__/rippleable.spec.ts +10 -9
  74. package/src/mixins/roundable/__tests__/roundable.spec.ts +7 -5
  75. package/src/mixins/routable/__tests__/routable.spec.ts +60 -52
  76. package/src/mixins/scrollable/__tests__/scrollable.spec.ts +56 -27
  77. package/src/mixins/selectable/__tests__/selectable.spec.ts +22 -9
  78. package/src/mixins/validatable/__tests__/validatable.spec.ts +194 -158
  79. package/src/mixins/validatable/index.ts +16 -18
@@ -2,28 +2,28 @@
2
2
  import Scrollable from '../'
3
3
 
4
4
  // Utilities
5
- import {
6
- mount,
7
- Wrapper,
8
- } from '@vue/test-utils'
5
+ import { mount, VueWrapper } from '@vue/test-utils'
6
+ import { defineComponent, h } from 'vue'
9
7
  import { scrollWindow } from '../../../../test'
10
8
 
11
9
  describe('Scrollable.ts', () => {
12
- type Instance = InstanceType<typeof Scrollable>
13
- let mountFunction: (options?: object) => Wrapper<Instance>
10
+ type Instance = InstanceType<typeof Scrollable>;
11
+ let mountFunction: (options?: object) => VueWrapper<Instance>
14
12
 
15
- beforeEach(() => {
16
- const Mock = {
13
+ const createMockComponent = (options = {}) => {
14
+ return defineComponent({
17
15
  mixins: [Scrollable],
18
- render (h) {
16
+ ...options,
17
+ render () {
19
18
  return h('div', {
20
- directives: [{
21
- name: 'scroll',
22
- value: this.onScroll,
23
- }],
19
+ onScroll: this.onScroll,
24
20
  })
25
21
  },
26
- }
22
+ })
23
+ }
24
+
25
+ beforeEach(() => {
26
+ const Mock = createMockComponent()
27
27
  mountFunction = (options = {}) => {
28
28
  return mount(Mock, {
29
29
  ...options,
@@ -34,15 +34,22 @@ describe('Scrollable.ts', () => {
34
34
  it('should set isScrollingUp', async () => {
35
35
  const wrapper = mountFunction()
36
36
 
37
+ // Сначала скроллим вниз
37
38
  await scrollWindow(1000)
39
+ wrapper.vm.onScroll()
40
+ await wrapper.vm.$nextTick()
38
41
  expect(wrapper.vm.isScrollingUp).toBe(false)
42
+
43
+ // Затем скроллим вверх
39
44
  await scrollWindow(0)
45
+ wrapper.vm.onScroll()
46
+ await wrapper.vm.$nextTick()
40
47
  expect(wrapper.vm.isScrollingUp).toBe(true)
41
48
  })
42
49
 
43
50
  it('should set a custom target', async () => {
44
51
  const wrapper = mountFunction({
45
- propsData: {
52
+ props: {
46
53
  scrollTarget: 'body',
47
54
  },
48
55
  })
@@ -53,10 +60,12 @@ describe('Scrollable.ts', () => {
53
60
 
54
61
  it('should do nothing if !canScroll', async () => {
55
62
  const wrapper = mountFunction({
56
- data: () => ({
57
- currentScroll: 100,
58
- previousScroll: 0,
59
- }),
63
+ data () {
64
+ return {
65
+ currentScroll: 100,
66
+ previousScroll: 0,
67
+ }
68
+ },
60
69
  computed: {
61
70
  canScroll () {
62
71
  return false
@@ -65,6 +74,7 @@ describe('Scrollable.ts', () => {
65
74
  })
66
75
 
67
76
  await scrollWindow(1000)
77
+ wrapper.vm.onScroll()
68
78
 
69
79
  expect(wrapper.vm.currentScroll).toBe(100)
70
80
  expect(wrapper.vm.previousScroll).toBe(0)
@@ -72,40 +82,59 @@ describe('Scrollable.ts', () => {
72
82
 
73
83
  it('should accept a custom scrollThreshold', async () => {
74
84
  const thresholdMet = jest.fn()
75
- const wrapper = mountFunction({
85
+
86
+ // Создаем специальный компонент с методом thresholdMet
87
+ const MockWithThreshold = createMockComponent({
88
+ props: {
89
+ scrollThreshold: {
90
+ type: Number,
91
+ default: 300,
92
+ },
93
+ },
76
94
  methods: {
77
95
  thresholdMet,
78
96
  },
79
- propsData: {
97
+ })
98
+
99
+ const wrapper = mount(MockWithThreshold, {
100
+ props: {
80
101
  scrollThreshold: 1000,
81
102
  },
82
103
  })
83
104
 
105
+ // Скроллим меньше порога
84
106
  await scrollWindow(900)
107
+ wrapper.vm.onScroll()
85
108
  await wrapper.vm.$nextTick()
86
109
 
87
110
  expect(thresholdMet).not.toHaveBeenCalled()
88
111
 
112
+ // Скроллим больше порога
89
113
  await scrollWindow(1001)
114
+ wrapper.vm.onScroll()
90
115
  await wrapper.vm.$nextTick()
91
116
  expect(thresholdMet).toHaveBeenCalled()
92
117
  })
93
118
 
94
- it('should reset savedScroll when isActive state changes', () => {
119
+ it('should reset savedScroll when isActive state changes', async () => {
95
120
  const wrapper = mountFunction({
96
- data: () => ({
97
- savedScroll: 100,
98
- }),
121
+ data () {
122
+ return {
123
+ savedScroll: 100,
124
+ }
125
+ },
99
126
  })
100
127
 
101
- wrapper.setData({ isActive: true })
128
+ // В Vue 3 используем прямое изменение данных
129
+ wrapper.vm.isActive = true
130
+ await wrapper.vm.$nextTick()
102
131
 
103
132
  expect(wrapper.vm.savedScroll).toBe(0)
104
133
  })
105
134
 
106
135
  it(`should warn if target isn't present`, async () => {
107
136
  mountFunction({
108
- propsData: {
137
+ props: {
109
138
  scrollTarget: '#test',
110
139
  },
111
140
  })
@@ -4,17 +4,22 @@ import Selectable from '../index'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- MountOptions,
8
- Wrapper,
7
+ VueWrapper,
8
+ MountingOptions,
9
+ enableAutoUnmount,
9
10
  } from '@vue/test-utils'
11
+ import { ComponentPublicInstance, h, defineComponent } from 'vue'
10
12
 
11
13
  describe('Selectable.ts', () => {
12
- const Mock = Selectable.extend({
13
- render: h => h('div'),
14
+ const Mock = defineComponent({
15
+ mixins: [Selectable],
16
+ render: () => h('div'),
14
17
  })
15
18
 
16
- type Instance = InstanceType<typeof Mock>
17
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
19
+ type Instance = ComponentPublicInstance & InstanceType<typeof Mock>
20
+ let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
21
+
22
+ enableAutoUnmount(afterEach)
18
23
 
19
24
  beforeEach(() => {
20
25
  mountFunction = (options = {}) => {
@@ -30,11 +35,19 @@ describe('Selectable.ts', () => {
30
35
  expect(wrapper.vm.lazyValue).toBeUndefined()
31
36
  expect(wrapper.vm.hasColor).toBeUndefined()
32
37
 
33
- wrapper.setProps({ inputValue: true })
34
-
35
- await wrapper.vm.$nextTick()
38
+ await wrapper.setProps({ modelValue: true })
36
39
 
37
40
  expect(wrapper.vm.lazyValue).toBe(true)
38
41
  expect(wrapper.vm.hasColor).toBe(true)
39
42
  })
43
+
44
+ it('should handle disabled state', async () => {
45
+ const wrapper = mountFunction({
46
+ props: {
47
+ disabled: true,
48
+ },
49
+ })
50
+
51
+ expect(wrapper.vm.rippleState).toBeUndefined()
52
+ })
40
53
  })