Skip to content

Commit 288d3a5

Browse files
fix: add props to stubs for built-in components (#1767)
Signed-off-by: Wolfgang Walther <[email protected]> Signed-off-by: Wolfgang Walther <[email protected]>
1 parent b79fc1f commit 288d3a5

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

src/stubs.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ export function stubComponents(
171171
return [
172172
createStub({
173173
name: 'transition',
174+
type: type as any,
174175
renderStubDefaultSlot: true
175176
}),
176-
undefined,
177+
props,
177178
children
178179
]
179180
}
@@ -185,9 +186,10 @@ export function stubComponents(
185186
return [
186187
createStub({
187188
name: 'transition-group',
189+
type: type as any,
188190
renderStubDefaultSlot: true
189191
}),
190-
undefined,
192+
props,
191193
children
192194
]
193195
}
@@ -199,9 +201,10 @@ export function stubComponents(
199201
return [
200202
createStub({
201203
name: 'teleport',
204+
type: type as any,
202205
renderStubDefaultSlot: true
203206
}),
204-
undefined,
207+
props,
205208
() => children
206209
]
207210
}

tests/features/transition.spec.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
import { expect, test } from 'vitest'
1+
import { describe, expect, test } from 'vitest'
22
import { WithTransition } from '../components/WithTransition'
33
import { mount } from '../../src'
44

5-
test('works with transitions', async () => {
6-
const wrapper = mount(WithTransition)
7-
expect(wrapper.find('#message').exists()).toBe(false)
5+
describe('transitions', () => {
6+
test('work', async () => {
7+
const wrapper = mount(WithTransition)
8+
expect(wrapper.find('#message').exists()).toBe(false)
89

9-
await wrapper.find('button').trigger('click')
10-
expect(wrapper.find('#message').exists()).toBe(true)
10+
await wrapper.find('button').trigger('click')
11+
expect(wrapper.find('#message').exists()).toBe(true)
12+
})
13+
14+
test('have props', () => {
15+
const wrapper = mount(WithTransition)
16+
expect(wrapper.getComponent({ name: 'transition' }).props('name')).toBe(
17+
'fade'
18+
)
19+
})
1120
})

tests/mountingOptions/global.stubs.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ describe('mounting options: stubs', () => {
401401
const wrapper = mount(CompStubbedByDefault)
402402

403403
expect(wrapper.html()).toBe(
404-
'<transition-stub>\n' +
404+
'<transition-stub appear="false" persisted="false" css="true">\n' +
405405
' <div id="content-stubbed-by-default"></div>\n' +
406406
'</transition-stub>'
407407
)
@@ -513,7 +513,7 @@ describe('mounting options: stubs', () => {
513513
})
514514

515515
expect(wrapper.html()).toBe(
516-
'<teleport-stub>\n' +
516+
'<teleport-stub to="body">\n' +
517517
' <div id="content"></div>\n' +
518518
'</teleport-stub>'
519519
)

0 commit comments

Comments
 (0)