-
Notifications
You must be signed in to change notification settings - Fork 23
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
a5c5504
commit 96617ba
Showing
2 changed files
with
32 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { render, screen } from '@testing-library/react' | ||
|
||
import TextInput from './TextInput' | ||
|
||
describe('TextInput', () => { | ||
describe('when rendered', () => { | ||
it('renders the textbox with the name of the label', () => { | ||
render(<TextInput label="label" />) | ||
|
||
const textbox = screen.getByRole('textbox', { name: /label/i }) | ||
expect(textbox).toBeInTheDocument() | ||
}) | ||
}) | ||
|
||
describe('when rendered without label', () => { | ||
it('renders the textbox with the placeholder as the label', () => { | ||
render(<TextInput placeholder="search orgs" />) | ||
|
||
const textbox = screen.getByRole('textbox', { name: /search orgs/i }) | ||
expect(textbox).toBeInTheDocument() | ||
}) | ||
}) | ||
|
||
describe('when rendered with icon', () => { | ||
it('renders an icon', () => { | ||
render(<TextInput icon="search" />) | ||
|
||
const icon = screen.getByTestId('search') | ||
expect(icon).toBeInTheDocument() | ||
}) | ||
}) | ||
}) |