@dimailn/vuetify 2.7.2-alpha20 → 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.
Files changed (98) hide show
  1. package/dist/vuetify.js +214 -84
  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/VOverlay/VOverlay.js +2 -3
  6. package/es5/components/VOverlay/VOverlay.js.map +1 -1
  7. package/es5/components/VProgressCircular/VProgressCircular.js +5 -3
  8. package/es5/components/VProgressCircular/VProgressCircular.js.map +1 -1
  9. package/es5/components/VProgressLinear/VProgressLinear.js +41 -19
  10. package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
  11. package/es5/components/VTabs/VTabs.js +1 -1
  12. package/es5/components/VTabs/VTabs.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/install.js +10 -33
  22. package/es5/install.js.map +1 -1
  23. package/es5/mixins/detachable/index.js +2 -3
  24. package/es5/mixins/detachable/index.js.map +1 -1
  25. package/es5/mixins/overlayable/index.js.map +1 -1
  26. package/es5/util/helpers.js +44 -0
  27. package/es5/util/helpers.js.map +1 -1
  28. package/es5/util/legacyEventsMixin.js +48 -0
  29. package/es5/util/legacyEventsMixin.js.map +1 -0
  30. package/lib/components/VOverlay/VOverlay.js +1 -2
  31. package/lib/components/VOverlay/VOverlay.js.map +1 -1
  32. package/lib/components/VProgressCircular/VProgressCircular.js +5 -3
  33. package/lib/components/VProgressCircular/VProgressCircular.js.map +1 -1
  34. package/lib/components/VProgressLinear/VProgressLinear.js +35 -17
  35. package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
  36. package/lib/components/VTabs/VTabs.js +1 -1
  37. package/lib/components/VTabs/VTabs.js.map +1 -1
  38. package/lib/components/VTabs/VTabsBar.js.map +1 -1
  39. package/lib/components/VVirtualScroll/VVirtualScroll.js +8 -11
  40. package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  41. package/lib/components/VWindow/VWindow.js +7 -3
  42. package/lib/components/VWindow/VWindow.js.map +1 -1
  43. package/lib/components/VWindow/VWindowItem.js +3 -1
  44. package/lib/components/VWindow/VWindowItem.js.map +1 -1
  45. package/lib/framework.js +1 -1
  46. package/lib/install.js +5 -28
  47. package/lib/install.js.map +1 -1
  48. package/lib/mixins/detachable/index.js +3 -4
  49. package/lib/mixins/detachable/index.js.map +1 -1
  50. package/lib/mixins/overlayable/index.js.map +1 -1
  51. package/lib/util/helpers.js +42 -0
  52. package/lib/util/helpers.js.map +1 -1
  53. package/lib/util/legacyEventsMixin.js +37 -0
  54. package/lib/util/legacyEventsMixin.js.map +1 -0
  55. package/package.json +1 -1
  56. package/src/components/VAvatar/__tests__/VAvatar.spec.ts +72 -10
  57. package/src/components/VOverlay/VOverlay.ts +1 -1
  58. package/src/components/VOverlay/__tests__/VOverlay.spec.ts +6 -6
  59. package/src/components/VProgressCircular/VProgressCircular.ts +6 -5
  60. package/src/components/VProgressCircular/__tests__/VProgressCircular.spec.ts +28 -21
  61. package/src/components/VProgressCircular/__tests__/__snapshots__/VProgressCircular.spec.ts.snap +62 -62
  62. package/src/components/VProgressLinear/VProgressLinear.ts +42 -22
  63. package/src/components/VProgressLinear/__tests__/VProgressLinear.spec.ts +378 -71
  64. package/src/components/VProgressLinear/__tests__/__snapshots__/VProgressLinear.spec.ts.snap +53 -79
  65. package/src/components/VSheet/__tests__/VSheet.spec.ts +5 -5
  66. package/src/components/VTabs/VTabs.ts +1 -1
  67. package/src/components/VTabs/VTabsBar.ts +7 -5
  68. package/src/components/VTabs/__tests__/VTab.spec.ts +48 -37
  69. package/src/components/VTabs/__tests__/VTabs.spec.ts +134 -79
  70. package/src/components/VTabs/__tests__/VTabsBar.spec.ts +67 -26
  71. package/src/components/VTabs/__tests__/VTabsSlider.spec.ts +7 -6
  72. package/src/components/VTabs/__tests__/__snapshots__/VTabs.spec.ts.snap +1 -3
  73. package/src/components/VVirtualScroll/VVirtualScroll.ts +14 -13
  74. package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +26 -19
  75. package/src/components/VWindow/VWindow.ts +9 -5
  76. package/src/components/VWindow/VWindowItem.ts +3 -1
  77. package/src/components/VWindow/__tests__/VWindow.spec.ts +226 -185
  78. package/src/components/VWindow/__tests__/VWindowItem.spec.ts +162 -132
  79. package/src/install.ts +10 -32
  80. package/src/mixins/applicationable/__tests__/applicationable.spec.ts +31 -27
  81. package/src/mixins/colorable/__tests__/colorable.spec.ts +9 -6
  82. package/src/mixins/detachable/index.ts +2 -1
  83. package/src/mixins/elevatable/__tests__/elevatable.spec.ts +14 -13
  84. package/src/mixins/intersectable/__tests__/intersectable.spec.ts +35 -29
  85. package/src/mixins/menuable/__tests__/menuable.spec.ts +76 -33
  86. package/src/mixins/mobile/__tests__/mobile.spec.ts +9 -6
  87. package/src/mixins/overlayable/__tests__/overlayable.spec.ts +32 -24
  88. package/src/mixins/overlayable/index.ts +1 -1
  89. package/src/mixins/proxyable/__tests__/proxyable.spec.ts +18 -17
  90. package/src/mixins/registrable/__tests__/registrable.spec.ts +31 -0
  91. package/src/mixins/rippleable/__tests__/rippleable.spec.ts +10 -9
  92. package/src/mixins/roundable/__tests__/roundable.spec.ts +7 -5
  93. package/src/mixins/routable/__tests__/routable.spec.ts +60 -52
  94. package/src/mixins/scrollable/__tests__/scrollable.spec.ts +56 -27
  95. package/src/mixins/selectable/__tests__/selectable.spec.ts +22 -9
  96. package/src/util/__tests__/helpers.spec.ts +62 -1
  97. package/src/util/helpers.ts +42 -1
  98. package/src/util/legacyEventsMixin.ts +34 -0
@@ -1,39 +1,45 @@
1
- import intersectable from '../index'
1
+ import intersectable from "../index";
2
+ import { defineComponent, h } from "vue";
3
+ import { mount, VueWrapper } from "@vue/test-utils";
2
4
 
3
- import {
4
- mount,
5
- Wrapper,
6
- } from '@vue/test-utils'
7
- import { ComponentOptions } from 'vue'
8
-
9
- describe('intersectable.ts', () => {
10
- let mountFunction: (options?: ComponentOptions<any>) => Wrapper<any>
5
+ describe("intersectable.ts", () => {
6
+ let mountFunction: (options?: any) => VueWrapper<any>;
11
7
 
12
8
  beforeEach(() => {
13
- mountFunction = (options?: ComponentOptions<any>) => {
14
- return mount({
15
- render: h => h('div'),
16
- ...options,
17
- })
18
- }
19
- })
20
-
21
- it('should call callbacks when element is intersected', () => {
22
- const callback = jest.fn()
9
+ mountFunction = (options?: any) => {
10
+ return mount(
11
+ defineComponent({
12
+ render: () => h("div"),
13
+ ...options
14
+ })
15
+ );
16
+ };
17
+ });
18
+
19
+ it("should call callbacks when element is intersected", () => {
20
+ const callback = jest.fn();
23
21
 
24
22
  const wrapper = mountFunction({
25
- mixins: [intersectable({ onVisible: ['callback'] })],
26
- methods: { callback },
27
- })
23
+ mixins: [intersectable({ onVisible: ["callback"] })],
24
+ methods: { callback }
25
+ });
28
26
 
29
- expect(callback).not.toHaveBeenCalled()
27
+ expect(callback).not.toHaveBeenCalled();
30
28
 
31
- wrapper.vm.onObserve([] as IntersectionObserverEntry[], null as any as IntersectionObserver, false)
29
+ wrapper.vm.onObserve(
30
+ [] as IntersectionObserverEntry[],
31
+ (null as any) as IntersectionObserver,
32
+ false
33
+ );
32
34
 
33
- expect(callback).not.toHaveBeenCalled()
35
+ expect(callback).not.toHaveBeenCalled();
34
36
 
35
- wrapper.vm.onObserve([] as IntersectionObserverEntry[], null as any as IntersectionObserver, true)
37
+ wrapper.vm.onObserve(
38
+ [] as IntersectionObserverEntry[],
39
+ (null as any) as IntersectionObserver,
40
+ true
41
+ );
36
42
 
37
- expect(callback).toHaveBeenCalledTimes(1)
38
- })
39
- })
43
+ expect(callback).toHaveBeenCalledTimes(1);
44
+ });
45
+ });
@@ -1,28 +1,39 @@
1
+ import { defineComponent, h } from 'vue'
1
2
  import Menuable from '../'
2
- import {
3
- mount,
4
- MountOptions,
5
- Wrapper,
6
- } from '@vue/test-utils'
3
+ import { mount, MountingOptions, VueWrapper } from '@vue/test-utils'
7
4
  import VApp from '../../../components/VApp'
8
5
 
9
6
  describe('menuable.ts', () => {
10
- const Mock = Menuable.extend({
11
- render: h => h('div'),
7
+ const Mock = defineComponent({
8
+ mixins: [Menuable],
9
+ render () {
10
+ return h('div')
11
+ },
12
12
  })
13
13
 
14
- type Instance = InstanceType<typeof Mock>
15
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
14
+ type Instance = InstanceType<typeof Mock>;
15
+ let mountFunction: (options?: MountingOptions<any>) => VueWrapper<any>
16
+
16
17
  beforeEach(() => {
17
- mountFunction = (options?: MountOptions<Instance>) => {
18
- return mount(Mock, options)
18
+ mountFunction = (options?: MountingOptions<any>) => {
19
+ return mount(Mock, {
20
+ global: {
21
+ mocks: {
22
+ $vuetify: {
23
+ theme: {},
24
+ rtl: false,
25
+ },
26
+ },
27
+ },
28
+ ...options,
29
+ })
19
30
  }
20
31
  })
21
32
 
22
33
  it('should bind custom activator', () => {
23
34
  const wrapper = mountFunction({
24
- attachToDocument: true,
25
- propsData: {
35
+ attachTo: document.body,
36
+ props: {
26
37
  activator: 'body',
27
38
  },
28
39
  })
@@ -32,10 +43,25 @@ describe('menuable.ts', () => {
32
43
 
33
44
  it('should update dimensions when activated', async () => {
34
45
  const sneakPeek = jest.fn()
35
- const wrapper = mountFunction({
46
+ const MockWithMethod = defineComponent({
47
+ mixins: [Menuable],
36
48
  methods: {
37
49
  sneakPeek,
38
50
  },
51
+ render () {
52
+ return h('div')
53
+ },
54
+ })
55
+
56
+ const wrapper = mount(MockWithMethod, {
57
+ global: {
58
+ mocks: {
59
+ $vuetify: {
60
+ theme: {},
61
+ rtl: false,
62
+ },
63
+ },
64
+ },
39
65
  })
40
66
 
41
67
  wrapper.vm.updateDimensions()
@@ -46,10 +72,6 @@ describe('menuable.ts', () => {
46
72
  it('should apply maxWidth in left calculations when offset', async () => {
47
73
  const wrapper = mountFunction({
48
74
  props: {
49
- offsetY: Boolean,
50
- offsetX: Boolean,
51
- },
52
- propsData: {
53
75
  attach: true,
54
76
  left: true,
55
77
  offsetX: true,
@@ -57,36 +79,57 @@ describe('menuable.ts', () => {
57
79
  },
58
80
  })
59
81
 
60
- wrapper.setData({
61
- dimensions: {
62
- activator: { width: 300 },
63
- content: { width: 138 },
82
+ // Настраиваем размеры для правильного тестирования
83
+ wrapper.vm.dimensions = {
84
+ activator: {
85
+ width: 100,
86
+ offsetLeft: 0,
87
+ left: 0,
64
88
  },
65
- })
89
+ content: {
90
+ width: 300,
91
+ },
92
+ }
93
+
94
+ // Мокаем pageWidth для создания сценария переполнения
95
+ wrapper.vm.pageWidth = 250
66
96
 
67
97
  await wrapper.vm.$nextTick()
68
98
 
99
+ // При left: true, offsetX: true и maxWidth: 200
100
+ // computedLeft должен быть: 0 - (300 - 100) + (-200) = -400
101
+ // Но с учетом calcXOverflow это должно дать -200
69
102
  expect(wrapper.vm.computedLeft).toBe(-200)
70
103
  })
71
104
 
72
105
  it('should have the correct position non attached', async () => {
73
- const wrapper = mount({
74
- render (h) {
75
- return h(VApp, [h(Mock)])
106
+ const AppComponent = defineComponent({
107
+ render () {
108
+ return h(
109
+ VApp,
110
+ {},
111
+ {
112
+ default: () => h(Mock),
113
+ }
114
+ )
76
115
  },
77
- }, {
78
- mocks: {
79
- sync: false,
80
- $vuetify: {
81
- theme: {},
82
- rtl: false,
116
+ })
117
+
118
+ const wrapper = mount(AppComponent, {
119
+ global: {
120
+ mocks: {
121
+ $vuetify: {
122
+ theme: {},
123
+ rtl: false,
124
+ },
83
125
  },
84
126
  },
85
127
  })
86
128
 
87
129
  await wrapper.vm.$nextTick()
88
130
 
89
- const { vm } = wrapper.find(Mock) as Wrapper<Instance>
131
+ const mockComponent = wrapper.findComponent(Mock)
132
+ const vm = mockComponent.vm
90
133
 
91
134
  Object.assign(vm.dimensions.activator, { top: 100, left: 80 })
92
135
  Object.assign(vm.dimensions.content, { width: 300, height: 50 })
@@ -5,6 +5,7 @@ import Mobile from '../'
5
5
  import { mount, Wrapper } from '@vue/test-utils'
6
6
  import { preset } from '../../../presets/default'
7
7
  import { resizeWindow } from '../../../../test'
8
+ import { defineComponent, h } from 'vue'
8
9
 
9
10
  // Types
10
11
  import { Breakpoint } from '../../../services/breakpoint'
@@ -14,16 +15,18 @@ describe('mobile.ts', () => {
14
15
  let mountFunction: (options?: object) => Wrapper<Instance>
15
16
 
16
17
  beforeEach(() => {
17
- const Mock = {
18
+ const Mock = defineComponent({
18
19
  mixins: [Mobile],
19
- render: h => h('div'),
20
- }
20
+ render: () => h('div'),
21
+ })
21
22
 
22
23
  mountFunction = (options = {}) => {
23
24
  return mount(Mock, {
24
25
  ...options,
25
- mocks: {
26
- $vuetify: { breakpoint: new Breakpoint(preset) },
26
+ global: {
27
+ mocks: {
28
+ $vuetify: { breakpoint: new Breakpoint(preset) },
29
+ },
27
30
  },
28
31
  })
29
32
  }
@@ -45,7 +48,7 @@ describe('mobile.ts', () => {
45
48
  await resizeWindow(resizeTo as number)
46
49
 
47
50
  const wrapper = mountFunction({
48
- propsData: { mobileBreakpoint },
51
+ props: { mobileBreakpoint },
49
52
  })
50
53
 
51
54
  expect(wrapper.vm.isMobile).toBe(isMobile)
@@ -2,34 +2,35 @@
2
2
  import Overlayable from '../index'
3
3
 
4
4
  // Utilities
5
- import {
6
- mount,
7
- MountOptions,
8
- Wrapper,
9
- } from '@vue/test-utils'
5
+ import { mount, MountingOptions, VueWrapper, enableAutoUnmount } from '@vue/test-utils'
10
6
  import { waitAnimationFrame } from '../../../../test'
7
+ import { defineComponent, h, nextTick } from 'vue'
11
8
 
12
9
  describe('Overlayable.ts', () => {
13
- const Mock = Overlayable.extend({
10
+ enableAutoUnmount(afterEach)
11
+
12
+ const Mock = defineComponent({
13
+ mixins: [Overlayable],
14
14
  data: () => ({
15
15
  isActive: false,
16
16
  }),
17
-
18
- render: h => h('div'),
17
+ render: () => h('div'),
19
18
  })
20
19
 
21
20
  beforeEach(() => {
22
21
  document.body.setAttribute('data-app', 'true')
23
22
  })
24
23
 
25
- type Instance = InstanceType<typeof Mock>
26
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
24
+ type Instance = InstanceType<typeof Mock>;
25
+ let mountFunction: (options?: MountingOptions<any>) => VueWrapper<any>
27
26
 
28
27
  beforeEach(() => {
29
28
  mountFunction = (options = {}) => {
30
29
  return mount(Mock, {
31
- mocks: {
32
- $vuetify: { breakpoint: {} },
30
+ global: {
31
+ mocks: {
32
+ $vuetify: { breakpoint: {} },
33
+ },
33
34
  },
34
35
  ...options,
35
36
  })
@@ -46,7 +47,7 @@ describe('Overlayable.ts', () => {
46
47
  expect(wrapper.vm.overlay).toBeTruthy()
47
48
 
48
49
  wrapper.vm.removeOverlay()
49
- // Simular overlay being rapidly opened/closed
50
+ // Simulate overlay being rapidly opened/closed
50
51
  wrapper.vm.overlay.value = true
51
52
 
52
53
  const event = new Event('transitionend')
@@ -78,7 +79,7 @@ describe('Overlayable.ts', () => {
78
79
  it('should get root element z-index if activeIndex is not available', async () => {
79
80
  const wrapper = mountFunction()
80
81
 
81
- wrapper.vm.$el.style.zIndex = 8
82
+ wrapper.vm.$el.style.zIndex = '8'
82
83
 
83
84
  wrapper.vm.genOverlay()
84
85
 
@@ -88,24 +89,31 @@ describe('Overlayable.ts', () => {
88
89
  })
89
90
 
90
91
  // https://github.com/vuetifyjs/vuetify/issues/8142
91
- it('should not update overlay state if not active', () => {
92
+ it('should not update overlay state if not active', async () => {
92
93
  const cb = jest.fn()
93
94
  const wrapper = mountFunction({
94
- methods: {
95
- removeOverlay: cb,
96
- genOVerlay: cb,
95
+ global: {
96
+ mocks: {
97
+ $vuetify: { breakpoint: {} },
98
+ },
97
99
  },
98
100
  })
99
101
 
100
- wrapper.setProps({ hideOverlay: true })
101
- wrapper.setProps({ hideOverlay: false })
102
+ // Mock the methods
103
+ wrapper.vm.removeOverlay = cb
104
+ wrapper.vm.genOverlay = cb
105
+
106
+ await wrapper.setProps({ hideOverlay: true })
107
+ await wrapper.setProps({ hideOverlay: false })
102
108
 
103
109
  expect(cb).not.toHaveBeenCalled()
104
110
 
105
- wrapper.setData({ isActive: true })
106
- wrapper.setProps({ hideOverlay: true })
107
- wrapper.setProps({ hideOverlay: false })
111
+ wrapper.vm.isActive = true
112
+ await nextTick()
113
+
114
+ await wrapper.setProps({ hideOverlay: true })
115
+ await wrapper.setProps({ hideOverlay: false })
108
116
 
109
- expect(cb).toHaveBeenCalledTimes(1)
117
+ expect(cb).toHaveBeenCalledTimes(2)
110
118
  })
111
119
  })
@@ -11,7 +11,7 @@ import {
11
11
  } from '../../util/helpers'
12
12
 
13
13
  // Types
14
- import {defineComponent, App, createApp, h} from 'vue'
14
+ import { defineComponent, App, createApp, h } from 'vue'
15
15
 
16
16
  interface Toggleable extends App {
17
17
  isActive?: boolean
@@ -3,15 +3,20 @@ import {
3
3
  mount,
4
4
  MountOptions,
5
5
  Wrapper,
6
+ enableAutoUnmount,
6
7
  } from '@vue/test-utils'
7
8
 
8
9
  describe('proxyable.ts', () => {
9
- const Mock = Proxyable.extend({
10
- render: h => h('div'),
11
- })
10
+ enableAutoUnmount(afterEach)
11
+
12
+ const Mock = {
13
+ mixins: [Proxyable],
14
+ template: '<div></div>',
15
+ }
12
16
 
13
17
  type Instance = InstanceType<typeof Mock>
14
18
  let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
19
+
15
20
  beforeEach(() => {
16
21
  mountFunction = (options?: MountOptions<Instance>) => {
17
22
  return mount(Mock, options)
@@ -19,46 +24,42 @@ describe('proxyable.ts', () => {
19
24
  })
20
25
 
21
26
  it('should watch prop and emit event', async () => {
22
- const change = jest.fn()
23
27
  const wrapper = mountFunction({
24
- propsData: { value: 'foo' },
28
+ props: { modelValue: 'foo' },
25
29
  })
26
30
 
27
- wrapper.vm.$on('change', change)
28
-
29
31
  expect(wrapper.vm.internalValue).toBe('foo')
30
32
 
31
33
  // Change by prop
32
- wrapper.setProps({ value: 'bar' })
34
+ await wrapper.setProps({ modelValue: 'bar' })
33
35
 
34
36
  expect(wrapper.vm.internalValue).toBe('bar')
35
- expect(change).not.toHaveBeenCalled()
37
+ expect(wrapper.emitted()).toEqual({})
36
38
 
37
39
  // Change internal
38
40
  wrapper.vm.internalValue = 'fizzbuzz'
39
41
 
40
42
  expect(wrapper.vm.internalValue).toBe('fizzbuzz')
41
43
 
42
- expect(change).toHaveBeenCalledWith('fizzbuzz')
44
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy()
45
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual(['fizzbuzz'])
43
46
  })
44
47
 
45
- it('should use provided prop and event arguments', () => {
46
- const input = jest.fn()
48
+ it('should use provided prop and event arguments', async () => {
47
49
  const wrapper = mount({
48
50
  mixins: [Proxy('input', 'update:input-value')],
49
- render: h => h('div'),
51
+ template: '<div></div>',
50
52
  }, {
51
- propsData: {
53
+ props: {
52
54
  input: 'foo',
53
55
  },
54
56
  })
55
57
 
56
- wrapper.vm.$on('update:input-value', input)
57
-
58
58
  expect(wrapper.vm.input).toBe('foo')
59
59
 
60
60
  wrapper.vm.internalValue = 'bar'
61
61
 
62
- expect(input).toHaveBeenCalledWith('bar')
62
+ expect(wrapper.emitted('update:input-value')).toBeTruthy()
63
+ expect(wrapper.emitted('update:input-value')?.[0]).toEqual(['bar'])
63
64
  })
64
65
  })
@@ -0,0 +1,31 @@
1
+ import { inject as RegistrableInject, provide as RegistrableProvide } from '../'
2
+ import {
3
+ mount,
4
+ MountingOptions,
5
+ VueWrapper,
6
+ } from '@vue/test-utils'
7
+ import { defineComponent } from 'vue'
8
+
9
+ describe('registrable.ts', () => {
10
+ it('should inject registrable', () => {
11
+ const Mock = defineComponent({
12
+ extends: RegistrableInject('test'),
13
+ render: () => null,
14
+ })
15
+
16
+ const wrapper = mount(Mock)
17
+
18
+ expect(wrapper.vm.test).toBeDefined()
19
+ })
20
+
21
+ it('should provide registrable', () => {
22
+ const Mock = defineComponent({
23
+ mixins: [RegistrableProvide('test')],
24
+ render: () => null,
25
+ })
26
+
27
+ const wrapper = mount(Mock)
28
+
29
+ expect(wrapper.vm.$options.provide).toBeDefined()
30
+ })
31
+ })
@@ -1,21 +1,22 @@
1
1
  import Rippleable from '../'
2
- import {
3
- mount,
4
- MountOptions,
5
- Wrapper,
6
- } from '@vue/test-utils'
2
+ import { mount, MountingOptions, VueWrapper } from '@vue/test-utils'
3
+ import { defineComponent } from 'vue'
7
4
 
8
5
  describe('rippleable.ts', () => {
9
- const Mock = Rippleable.extend({
6
+ const Mock = defineComponent({
7
+ extends: Rippleable,
10
8
  render () {
11
9
  return this.genRipple()
12
10
  },
13
11
  })
14
12
 
15
- type Instance = InstanceType<typeof Mock>
16
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
13
+ type Instance = InstanceType<typeof Mock>;
14
+ let mountFunction: (
15
+ options?: MountingOptions<Instance>
16
+ ) => VueWrapper<Instance>
17
+
17
18
  beforeEach(() => {
18
- mountFunction = (options?: MountOptions<Instance>) => {
19
+ mountFunction = (options?: MountingOptions<Instance>) => {
19
20
  return mount(Mock, options)
20
21
  }
21
22
  })
@@ -1,3 +1,4 @@
1
+ import { defineComponent, h } from 'vue'
1
2
  import Roundable from '../'
2
3
  import {
3
4
  mount,
@@ -5,11 +6,12 @@ import {
5
6
  Wrapper,
6
7
  } from '@vue/test-utils'
7
8
 
8
- describe('rippleable.ts', () => {
9
- const Mock = Roundable.extend({
10
- render (h) {
9
+ describe('roundable.ts', () => {
10
+ const Mock = defineComponent({
11
+ mixins: [Roundable],
12
+ render () {
11
13
  return h('div', {
12
- class: this.roundableClasses,
14
+ class: this.roundedClasses,
13
15
  })
14
16
  },
15
17
  })
@@ -31,7 +33,7 @@ describe('rippleable.ts', () => {
31
33
  [{ rounded: false }, {}],
32
34
  [{ rounded: 'tr-xl br-lg' }, { 'rounded-tr-xl rounded-br-lg': true }],
33
35
  ])('should return correct rounded classes', (propsData, expected: any) => {
34
- const wrapper = mountFunction({ propsData })
36
+ const wrapper = mountFunction({ props: propsData })
35
37
 
36
38
  expect(wrapper.vm.roundedClasses).toEqual(expected)
37
39
  })