-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
bcc7d9c
commit 63bde0f
Showing
1 changed file
with
43 additions
and
3 deletions.
There are no files selected for viewing
46 changes: 43 additions & 3 deletions
46
src/components/molecules/modal/TitleBar/title-bar.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,7 +1,47 @@ | ||
describe('IconButton', () => { | ||
import { act, configure, render } from '@testing-library/react'; | ||
import { ModalTitleBarProps } from './title-bar.interface'; | ||
import { UseFormReturn, useForm } from 'react-hook-form'; | ||
import { ModalTitleBar } from './title-bar'; | ||
import '@testing-library/jest-dom'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
describe('TitleBar', () => { | ||
let modalTitleBarProps: ModalTitleBarProps; | ||
|
||
beforeEach(() => { | ||
configure({ throwSuggestions: true }); | ||
|
||
modalTitleBarProps = { | ||
title: 'title', | ||
handleCloseClick: jest.fn(), | ||
}; | ||
}); | ||
|
||
it('should render', () => { | ||
expect(true).toBeTruthy(); | ||
const { baseElement } = render(<ModalTitleBar {...modalTitleBarProps} />); | ||
expect(baseElement).toBeTruthy(); | ||
}); | ||
|
||
describe('when the button is clicked', () => {}); | ||
describe('when the title bar is rendered', () => { | ||
it('should have the correct title', () => { | ||
const { getByText } = render(<ModalTitleBar {...modalTitleBarProps} />); | ||
const title = getByText('title'); | ||
expect(title).toBeTruthy(); | ||
}); | ||
|
||
it('should render the close button', () => { | ||
const { getByRole } = render(<ModalTitleBar {...modalTitleBarProps} />); | ||
const button = getByRole('button'); | ||
expect(button).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe('when the close button is clicked', () => { | ||
it('should call the handleCloseClick function', () => { | ||
const { getByRole } = render(<ModalTitleBar {...modalTitleBarProps} />); | ||
const button = getByRole('button'); | ||
button.click(); | ||
expect(modalTitleBarProps.handleCloseClick).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |