@@ -15,22 +15,22 @@ const testComponent = (onMount = true) => ({
1515 <div>
1616 <div id="isIdle" v-if="isIdle"></div>
1717 <div id="isReady" v-if="isReady">
18- <button id="cancelTimer " @click="cancelTimer "></button>
19- <button id="resetTimer " @click="resetTimer "></button>
18+ <button id="cancel " @click="cancel "></button>
19+ <button id="reset " @click="reset "></button>
2020 <div id="isCallbackCalled" v-if="isCallbackCalled"></div>
2121 </div>
2222 </div>
2323 ` ,
2424 setup ( ) {
2525 const isCallbackCalled = ref ( false )
26- const { isReady, isIdle, cancelTimer , resetTimer } = useTimeoutFn (
26+ const { isReady, isIdle, cancel , reset } = useTimeoutFn (
2727 ( ) => {
2828 isCallbackCalled . value = true
2929 } ,
3030 1000 ,
3131 onMount
3232 )
33- return { isReady, isIdle, cancelTimer , resetTimer , isCallbackCalled }
33+ return { isReady, isIdle, cancel , reset , isCallbackCalled }
3434 }
3535} )
3636
@@ -41,26 +41,26 @@ describe('useTimeoutFn', () => {
4141 expect ( setTimeout ) . toHaveBeenCalledTimes ( 1 )
4242 } )
4343
44- it ( 'should call setTimeout again when resetTimer is called' , async ( ) => {
44+ it ( 'should call setTimeout again when reset is called' , async ( ) => {
4545 expect ( setTimeout ) . toHaveBeenCalledTimes ( 0 )
4646 const wrapper = mount ( testComponent ( ) )
4747 expect ( setTimeout ) . toHaveBeenCalledTimes ( 1 )
4848 jest . runAllTimers ( )
4949
50- // Wait for Vue to append #resetTimer in the DOM
50+ // Wait for Vue to append #reset in the DOM
5151 await wrapper . vm . $nextTick ( )
52- wrapper . find ( '#resetTimer ' ) . trigger ( 'click' )
52+ wrapper . find ( '#reset ' ) . trigger ( 'click' )
5353 expect ( setTimeout ) . toHaveBeenCalledTimes ( 2 )
5454 } )
5555
56- it ( 'should hide all elements when cancelTimer is called' , async ( ) => {
56+ it ( 'should hide all elements when cancel is called' , async ( ) => {
5757 const wrapper = mount ( testComponent ( ) )
5858 jest . runAllTimers ( )
5959
6060 // Wait for Vue to append #isReady in the DOM
6161 await wrapper . vm . $nextTick ( )
6262 expect ( wrapper . find ( '#isReady' ) . exists ( ) ) . toBe ( true )
63- wrapper . find ( '#cancelTimer ' ) . trigger ( 'click' )
63+ wrapper . find ( '#cancel ' ) . trigger ( 'click' )
6464 jest . runAllTimers ( )
6565
6666 // Wait for Vue to remove #isReady from the DOM
0 commit comments