Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add props to stubs for built-in components #1767

Merged
merged 1 commit into from Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/stubs.ts
Expand Up @@ -171,9 +171,10 @@ export function stubComponents(
return [
createStub({
name: 'transition',
type: type as any,
renderStubDefaultSlot: true
}),
undefined,
props,
children
]
}
Expand All @@ -185,9 +186,10 @@ export function stubComponents(
return [
createStub({
name: 'transition-group',
type: type as any,
renderStubDefaultSlot: true
}),
undefined,
props,
children
]
}
Expand All @@ -199,9 +201,10 @@ export function stubComponents(
return [
createStub({
name: 'teleport',
type: type as any,
renderStubDefaultSlot: true
}),
undefined,
props,
() => children
]
}
Expand Down
21 changes: 15 additions & 6 deletions tests/features/transition.spec.ts
@@ -1,11 +1,20 @@
import { expect, test } from 'vitest'
import { describe, expect, test } from 'vitest'
import { WithTransition } from '../components/WithTransition'
import { mount } from '../../src'

test('works with transitions', async () => {
const wrapper = mount(WithTransition)
expect(wrapper.find('#message').exists()).toBe(false)
describe('transitions', () => {
test('work', async () => {
const wrapper = mount(WithTransition)
expect(wrapper.find('#message').exists()).toBe(false)

await wrapper.find('button').trigger('click')
expect(wrapper.find('#message').exists()).toBe(true)
await wrapper.find('button').trigger('click')
expect(wrapper.find('#message').exists()).toBe(true)
})

test('have props', () => {
const wrapper = mount(WithTransition)
expect(wrapper.getComponent({ name: 'transition' }).props('name')).toBe(
'fade'
)
})
})
4 changes: 2 additions & 2 deletions tests/mountingOptions/global.stubs.spec.ts
Expand Up @@ -401,7 +401,7 @@ describe('mounting options: stubs', () => {
const wrapper = mount(CompStubbedByDefault)

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

expect(wrapper.html()).toBe(
'<teleport-stub>\n' +
'<teleport-stub to="body">\n' +
' <div id="content"></div>\n' +
'</teleport-stub>'
)
Expand Down