Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(useTransition): support for delayed transitions (#386)
- Loading branch information
1 parent
734c388
commit b5d5dec
Showing
5 changed files
with
91 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { promiseTimeout } from '@vueuse/core' | ||
import { ref } from 'vue-demi' | ||
import { useTimeoutFn } from '.' | ||
|
||
describe('useTimeoutFn', () => { | ||
it('supports reactive intervals', async() => { | ||
const callback = jest.fn() | ||
const interval = ref(0) | ||
const { start } = useTimeoutFn(callback, interval) | ||
|
||
start() | ||
await promiseTimeout(1) | ||
expect(callback).toHaveBeenCalled() | ||
|
||
callback.mockReset() | ||
interval.value = 50 | ||
|
||
start() | ||
await promiseTimeout(1) | ||
expect(callback).not.toHaveBeenCalled() | ||
await promiseTimeout(100) | ||
expect(callback).toHaveBeenCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters