Skip to content

Commit

Permalink
fix: add props to stubs for built-in components (#1767)
Browse files Browse the repository at this point in the history
Signed-off-by: Wolfgang Walther <walther@technowledgy.de>

Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
  • Loading branch information
wolfgangwalther committed Sep 16, 2022
1 parent b79fc1f commit 288d3a5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
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

0 comments on commit 288d3a5

Please sign in to comment.