test(transition): add invalid durations test case (#1702)

This commit is contained in:
Che Guevara 2020-07-29 03:36:36 +08:00 committed by GitHub
parent 5681fdb211
commit 06cad62ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1799,7 +1799,41 @@ describe('e2e: Transition', () => {
E2E_TIMEOUT
)
// fixme
test.todo('warn invalid durations')
test(
'warn invalid durations',
async () => {
createApp({
template: `
<div id="container">
<transition name="test" :duration="NaN">
<div class="test">content</div>
</transition>
</div>
`
}).mount(document.createElement('div'))
expect(
`[Vue warn]: <transition> explicit duration is NaN - ` +
'the duration expression might be incorrect.'
).toHaveBeenWarned()
createApp({
template: `
<div id="container">
<transition name="test" :duration="{
enter: {},
leave: {}
}">
<div class="test">content</div>
</transition>
</div>
`
}).mount(document.createElement('div'))
expect(
`[Vue warn]: <transition> explicit duration is not a valid number - ` +
`got ${JSON.stringify({})}`
).toHaveBeenWarned()
},
E2E_TIMEOUT
)
})
})