Skip to content

Commit 06cad62

Browse files
authored
test(transition): add invalid durations test case (vuejs#1702)
1 parent 5681fdb commit 06cad62

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

packages/vue/__tests__/Transition.spec.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,41 @@ describe('e2e: Transition', () => {
17991799
E2E_TIMEOUT
18001800
)
18011801

1802-
// fixme
1803-
test.todo('warn invalid durations')
1802+
test(
1803+
'warn invalid durations',
1804+
async () => {
1805+
createApp({
1806+
template: `
1807+
<div id="container">
1808+
<transition name="test" :duration="NaN">
1809+
<div class="test">content</div>
1810+
</transition>
1811+
</div>
1812+
`
1813+
}).mount(document.createElement('div'))
1814+
expect(
1815+
`[Vue warn]: <transition> explicit duration is NaN - ` +
1816+
'the duration expression might be incorrect.'
1817+
).toHaveBeenWarned()
1818+
1819+
createApp({
1820+
template: `
1821+
<div id="container">
1822+
<transition name="test" :duration="{
1823+
enter: {},
1824+
leave: {}
1825+
}">
1826+
<div class="test">content</div>
1827+
</transition>
1828+
</div>
1829+
`
1830+
}).mount(document.createElement('div'))
1831+
expect(
1832+
`[Vue warn]: <transition> explicit duration is not a valid number - ` +
1833+
`got ${JSON.stringify({})}`
1834+
).toHaveBeenWarned()
1835+
},
1836+
E2E_TIMEOUT
1837+
)
18041838
})
18051839
})

0 commit comments

Comments
 (0)