chore: improve BaseTransition (#4811)
This commit is contained in:
parent
89c54ee2b9
commit
4e1131e251
@ -161,7 +161,11 @@ const BaseTransitionImpl: ComponentOptions = {
|
|||||||
const rawProps = toRaw(props)
|
const rawProps = toRaw(props)
|
||||||
const { mode } = rawProps
|
const { mode } = rawProps
|
||||||
// check mode
|
// check mode
|
||||||
if (__DEV__ && mode && !['in-out', 'out-in', 'default'].includes(mode)) {
|
if (
|
||||||
|
__DEV__ &&
|
||||||
|
mode &&
|
||||||
|
mode !== 'in-out' && mode !== 'out-in' && mode !== 'default'
|
||||||
|
) {
|
||||||
warn(`invalid <transition> mode: ${mode}`)
|
warn(`invalid <transition> mode: ${mode}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1969,6 +1969,21 @@ describe('e2e: Transition', () => {
|
|||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('warn when invalid transition mode', () => {
|
||||||
|
createApp({
|
||||||
|
template: `
|
||||||
|
<div id="container">
|
||||||
|
<transition name="test" mode="none">
|
||||||
|
<div class="test">content</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
}).mount(document.createElement('div'))
|
||||||
|
expect(
|
||||||
|
`invalid <transition> mode: none`
|
||||||
|
).toHaveBeenWarned()
|
||||||
|
})
|
||||||
|
|
||||||
// #3227
|
// #3227
|
||||||
test(`HOC w/ merged hooks`, async () => {
|
test(`HOC w/ merged hooks`, async () => {
|
||||||
const innerSpy = jest.fn()
|
const innerSpy = jest.fn()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user