-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from Gkuzin13/dev
Dev
- Loading branch information
Showing
14 changed files
with
85 additions
and
52 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
29 changes: 22 additions & 7 deletions
29
apps/client/src/components/Panels/ZoomPanel/ZoomPanel.test.tsx
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,19 +1,34 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import { ZOOM } from '@/constants/panels/zoom'; | ||
import ZoomPanel from './ZoomPanel'; | ||
|
||
describe('ZoomPanel', () => { | ||
it('should call handleZoomChange when clicked', () => { | ||
it('should call handleZoomChange when zoom in clicked', () => { | ||
const handleZoomChange = vi.fn(); | ||
|
||
render(<ZoomPanel value={100} onZoomChange={handleZoomChange} />); | ||
|
||
const zoomActions = Object.values(ZOOM); | ||
fireEvent.click(screen.getByTestId('zoom-in-button')); | ||
|
||
zoomActions.forEach((action) => { | ||
fireEvent.click(screen.getByTitle(new RegExp(action.name))); | ||
}); | ||
expect(handleZoomChange).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should call handleZoomChange when zoom out clicked', () => { | ||
const handleZoomChange = vi.fn(); | ||
|
||
render(<ZoomPanel value={100} onZoomChange={handleZoomChange} />); | ||
|
||
fireEvent.click(screen.getByTestId('zoom-out-button')); | ||
|
||
expect(handleZoomChange).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should call handleZoomChange when zoom reset clicked', () => { | ||
const handleZoomChange = vi.fn(); | ||
|
||
render(<ZoomPanel value={120} onZoomChange={handleZoomChange} />); | ||
|
||
fireEvent.click(screen.getByTestId('zoom-reset-button')); | ||
|
||
expect(handleZoomChange).toHaveBeenCalledTimes(zoomActions.length); | ||
expect(handleZoomChange).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
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