-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interpolate Box component into oneColor as children
- Loading branch information
Showing
3 changed files
with
25 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
23 changes: 8 additions & 15 deletions
23
src/client/modules/color/components/OneColor/index.spec.jsx
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,36 +1,29 @@ | ||
import { render, fireEvent } from 'test-utils'; | ||
import Box from '.'; | ||
import OneColorWrapper from '.'; | ||
import { boxInfo } from '../../../../../testing/dataMock'; | ||
|
||
describe('render properly', () => { | ||
const likeCb = jest.fn(); | ||
const shareCb = jest.fn(); | ||
const downloadCb = jest.fn(); | ||
|
||
test('render properly with click', () => { | ||
const { container, getByText } = render( | ||
<Box | ||
const { getByText } = render( | ||
<OneColorWrapper | ||
id={boxInfo.id} | ||
username={boxInfo.username} | ||
value={boxInfo.color} | ||
starNum={boxInfo.star} | ||
starred | ||
onLike={likeCb} | ||
onCopy={jest.fn()} | ||
onShare={shareCb} | ||
onDownload={downloadCb} | ||
/> | ||
> | ||
<div /> | ||
</OneColorWrapper> | ||
); | ||
|
||
fireEvent.click(getByText('Red Heart')); | ||
fireEvent.click(getByText('Download')); | ||
fireEvent.click(getByText('E-Mail')); | ||
fireEvent.click(getByText('FaceBook')); | ||
fireEvent.click(getByText('Twitter')); | ||
fireEvent.click(container.querySelector('ul')); | ||
|
||
expect(likeCb).toBeCalled(); | ||
expect(shareCb).toBeCalled(); | ||
expect(downloadCb).toBeCalled(); | ||
expect(shareCb).toBeCalledTimes(3); | ||
expect(downloadCb).toBeCalledTimes(1); | ||
}); | ||
}); |