fix(transition): toggling branches with in-out mode should be transitioned correctly (#3109)
fix #3104
This commit is contained in:
parent
b2e00f011a
commit
67a0290c0a
@ -247,14 +247,17 @@ describe('BaseTransition', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('toggle on-off', () => {
|
describe('toggle on-off', () => {
|
||||||
async function testToggleOnOff({
|
async function testToggleOnOff(
|
||||||
trueBranch,
|
{
|
||||||
trueSerialized,
|
trueBranch,
|
||||||
falseBranch,
|
trueSerialized,
|
||||||
falseSerialized
|
falseBranch,
|
||||||
}: ToggleOptions) {
|
falseSerialized
|
||||||
|
}: ToggleOptions,
|
||||||
|
mode?: BaseTransitionProps['mode']
|
||||||
|
) {
|
||||||
const toggle = ref(true)
|
const toggle = ref(true)
|
||||||
const { props, cbs } = mockProps()
|
const { props, cbs } = mockProps({ mode })
|
||||||
const root = mount(
|
const root = mount(
|
||||||
props,
|
props,
|
||||||
() => (toggle.value ? trueBranch() : falseBranch())
|
() => (toggle.value ? trueBranch() : falseBranch())
|
||||||
@ -322,6 +325,18 @@ describe('BaseTransition', () => {
|
|||||||
falseSerialized: `<!---->`
|
falseSerialized: `<!---->`
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('w/ mode: "in-out', async () => {
|
||||||
|
await testToggleOnOff(
|
||||||
|
{
|
||||||
|
trueBranch: () => h('div'),
|
||||||
|
trueSerialized: `<div></div>`,
|
||||||
|
falseBranch: () => null,
|
||||||
|
falseSerialized: `<!---->`
|
||||||
|
},
|
||||||
|
'in-out'
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('toggle on-off before finish', () => {
|
describe('toggle on-off before finish', () => {
|
||||||
|
@ -223,7 +223,7 @@ const BaseTransitionImpl = {
|
|||||||
instance.update()
|
instance.update()
|
||||||
}
|
}
|
||||||
return emptyPlaceholder(child)
|
return emptyPlaceholder(child)
|
||||||
} else if (mode === 'in-out') {
|
} else if (mode === 'in-out' && innerChild.type !== Comment) {
|
||||||
leavingHooks.delayLeave = (
|
leavingHooks.delayLeave = (
|
||||||
el: TransitionElement,
|
el: TransitionElement,
|
||||||
earlyRemove,
|
earlyRemove,
|
||||||
|
Loading…
Reference in New Issue
Block a user