Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbedard committed Apr 14, 2023
1 parent 3889b46 commit fe1ec45
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/core/useTransition/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,26 @@ describe('useTransition', () => {
expect(transition.value).toBe(1)
})

it('supports non-linear custom easing functions', async () => {
const source = ref(0)
const easeInQuad = vi.fn(n => n * n)
const transition = useTransition(source, {
duration: 100,
transition: easeInQuad,
})

expect(easeInQuad).not.toBeCalled()

source.value = 1

await promiseTimeout(50)
expect(easeInQuad).toBeCalled()
expectBetween(transition.value, 0, 1)

await promiseTimeout(100)
expect(transition.value).toBe(1)
})

it('supports delayed transitions', async () => {
const source = ref(0)

Expand Down

0 comments on commit fe1ec45

Please sign in to comment.