-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
173 additions
and
93 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
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
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { screen, render, fireEvent } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { OnEnter } from 'index'; | ||
import { TiltTest } from 'utils/TiltTest'; | ||
|
||
describe('Tilt - onEnter', () => { | ||
it('should trigger onEnter event when mouse enters an element', () => { | ||
const onEnter = vi.fn(); | ||
const onEnter = vi.fn<OnEnter>(); | ||
|
||
render(<TiltTest onEnter={onEnter} />); | ||
|
||
fireEvent.mouseEnter(screen.getByText('test')); | ||
|
||
expect(onEnter).toHaveBeenCalledWith('mouseenter'); | ||
const onEnterParams = onEnter.mock.calls[0][0]; | ||
expect(onEnterParams.event.type).toBe('mouseenter'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { screen, render, fireEvent } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { OnLeave } from 'index'; | ||
import { TiltTest } from 'utils/TiltTest'; | ||
|
||
describe('Tilt - onLeave', () => { | ||
it('should trigger onLeave event when mouse leaves an element', () => { | ||
const onLeave = vi.fn(); | ||
const onLeave = vi.fn<OnLeave>(); | ||
|
||
render(<TiltTest onLeave={onLeave} />); | ||
|
||
fireEvent.mouseLeave(screen.getByText('test')); | ||
|
||
expect(onLeave).toHaveBeenCalledWith('mouseleave'); | ||
const onLeaveParams = onLeave.mock.calls[0][0]; | ||
expect(onLeaveParams.event.type).toBe('mouseleave'); | ||
}); | ||
}); |
Oops, something went wrong.