Skip to content

Commit 14961a0

Browse files
Удален ненужный код проверки активации слота в компоненте VTooltip
1 parent 610c7e7 commit 14961a0

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

packages/vuetify/src/components/VTooltip/VTooltip.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ export default mixins(Colorable, Delayable, Dependent, Menuable).extend({
140140
})
141141
},
142142

143-
mounted () {
144-
if (getSlotType(this, 'activator', true) === 'v-slot') {
145-
consoleError(`v-tooltip's activator slot must be bound, try '<template #activator="data"><v-btn v-on="data.on>'`, this)
146-
}
147-
},
148-
149143
methods: {
150144
activate () {
151145
// Update coordinates and dimensions of menu

packages/vuetify/src/components/VTooltip/__tests__/VTooltip.spec.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('VTooltip', () => {
2727
top: true,
2828
},
2929
slots: {
30-
activator: () => h('span', 'activator'),
30+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
3131
default: () => h('span', 'content'),
3232
},
3333
})
@@ -49,7 +49,7 @@ describe('VTooltip', () => {
4949
left: true,
5050
},
5151
slots: {
52-
activator: () => h('span', 'activator'),
52+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
5353
default: () => h('span', 'content'),
5454
},
5555
})
@@ -71,7 +71,7 @@ describe('VTooltip', () => {
7171
bottom: true,
7272
},
7373
slots: {
74-
activator: () => h('span', 'activator'),
74+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
7575
default: () => h('span', 'content'),
7676
},
7777
})
@@ -93,7 +93,7 @@ describe('VTooltip', () => {
9393
right: true,
9494
},
9595
slots: {
96-
activator: () => h('span', 'activator'),
96+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
9797
default: () => h('span', 'content'),
9898
},
9999
})
@@ -114,7 +114,7 @@ describe('VTooltip', () => {
114114
eager: true,
115115
},
116116
slots: {
117-
activator: () => h('span', 'activator'),
117+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
118118
default: () => h('span', 'content'),
119119
},
120120
})
@@ -128,7 +128,7 @@ describe('VTooltip', () => {
128128
modelValue: true,
129129
},
130130
slots: {
131-
activator: () => h('span', 'activator'),
131+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
132132
default: () => h('span', 'content'),
133133
},
134134
})
@@ -145,7 +145,7 @@ describe('VTooltip', () => {
145145
maxWidth: 200,
146146
},
147147
slots: {
148-
activator: () => h('span', 'activator'),
148+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
149149
default: () => h('span', 'content'),
150150
},
151151
})
@@ -197,18 +197,19 @@ describe('VTooltip', () => {
197197
jest.useRealTimers()
198198
})
199199

200-
it(`should warn if activator isn't scoped`, () => {
201-
mountFunction({
200+
it(`should work with normal activator slot`, () => {
201+
const wrapper = mountFunction({
202202
props: {
203203
openDelay: 0,
204204
},
205205
slots: {
206-
activator: () => h('span', 'activator'),
206+
activator: function({ on }: any) { return h('span', { ...on }, 'activator') },
207207
default: () => h('span', 'content'),
208208
},
209209
})
210210

211-
expect(`[Vuetify] The activator slot must be bound, try '<template v-slot:activator="{ on }"><v-btn v-on="on">'`).toHaveBeenWarned()
211+
// In Vue 3, all slots are functions and should work correctly
212+
expect(wrapper.html()).toContain('activator')
212213
})
213214

214215
it(`should open and close`, () => {

0 commit comments

Comments
 (0)