Skip to content

update user event usage in specs #395

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

Merged
merged 7 commits into from
Jul 12, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update spec 00 to user-event
  • Loading branch information
markgoho authored Jun 16, 2023
commit 33b077681a0fa30724c49444ea3894ae7c39832c
11 changes: 6 additions & 5 deletions apps/example-app/src/app/examples/00-single-component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { render, screen, fireEvent } from '@testing-library/angular';

import { render, screen } from '@testing-library/angular';
import userEvent from '@testing-library/user-event';
import { SingleComponent } from './00-single-component';

test('renders the current value and can increment and decrement', async () => {
const user = userEvent.setup();
await render(SingleComponent);

const incrementControl = screen.getByRole('button', { name: /increment/i });
Expand All @@ -11,10 +12,10 @@ test('renders the current value and can increment and decrement', async () => {

expect(valueControl).toHaveTextContent('0');

fireEvent.click(incrementControl);
fireEvent.click(incrementControl);
await user.click(incrementControl);
await user.click(incrementControl);
expect(valueControl).toHaveTextContent('2');

fireEvent.click(decrementControl);
await user.click(decrementControl);
expect(valueControl).toHaveTextContent('1');
});