-
-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make user dashboard responsive
- Loading branch information
Showing
9 changed files
with
151 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
import { ToggleMenuButton } from './ToggleMenuButton'; | ||
|
||
describe('ToggleMenuButton', () => { | ||
describe('onClick props', () => { | ||
it('should call the callback when the user click on the button', async () => { | ||
const handler = jest.fn(); | ||
|
||
render(<ToggleMenuButton onClick={handler} />); | ||
const button = screen.getByRole('button'); | ||
await userEvent.click(button); | ||
|
||
expect(handler).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
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,44 @@ | ||
import { act, renderHook } from '@testing-library/react'; | ||
|
||
import { useMenu } from './UseMenu'; | ||
|
||
describe('UseMenu', () => { | ||
describe('Render hook', () => { | ||
it("shouldn't show the menu by default", async () => { | ||
const { result } = renderHook(() => useMenu()); | ||
|
||
expect(result.current.showMenu).toBeFalsy(); | ||
}); | ||
|
||
it('should make the menu visible by toggling the menu', () => { | ||
const { result } = renderHook(() => useMenu()); | ||
|
||
act(() => { | ||
result.current.handleToggleMenu(); | ||
}); | ||
|
||
expect(result.current.showMenu).toBeTruthy(); | ||
}); | ||
|
||
it("shouldn't make the menu visible after toggling and closing the menu", () => { | ||
const { result } = renderHook(() => useMenu()); | ||
|
||
act(() => { | ||
result.current.handleClose(); | ||
}); | ||
|
||
expect(result.current.showMenu).toBeFalsy(); | ||
}); | ||
|
||
it("shouldn't make the menu visible after toggling the menu twice", () => { | ||
const { result } = renderHook(() => useMenu()); | ||
|
||
act(() => { | ||
result.current.handleToggleMenu(); | ||
result.current.handleToggleMenu(); | ||
}); | ||
|
||
expect(result.current.showMenu).toBeFalsy(); | ||
}); | ||
}); | ||
}); |