Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intentionally fail a unit test #1

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/MaskedSecureInput/MaskedSecureInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import MaskedSecureInput from './MaskedSecureInput';
describe('<MaskedSecureInput />', () => {
it('should render', async () => {
render(<MaskedSecureInput format="###-##-####" label="Label" />);

const element = screen.getByLabelText('Label');
expect(element).toBeInTheDocument();
expect(element).toBeVisible();
});

it('should toggle the visiblity of the value when blurred and focused', async () => {
render(<MaskedSecureInput format="###-##-####" label="Label" />);

const element = screen.getByLabelText('Label');
await userEvent.type(element, '123456789');
await userEvent.click(document.body);
Expand All @@ -27,6 +29,7 @@ describe('<MaskedSecureInput />', () => {
it('should output the unformatted value on change', async () => {
const onChange = vi.fn();
render(<MaskedSecureInput format="###-##-####" label="Label" onChange={onChange} />);

const element = screen.getByLabelText('Label');
await userEvent.type(element, '123456789');
expect(element).toHaveValue('123-45-6789');
Expand Down Expand Up @@ -58,6 +61,7 @@ describe('<MaskedSecureInput />', () => {
it('should have inter-op with useForm()', async () => {
const onSubmit = vi.fn();
render(<TestForm onSubmit={onSubmit} />);

const element = screen.getByLabelText('Label');
await userEvent.type(element, '123456789');
await userEvent.click(screen.getByText('Submit'));
Expand Down
Loading