Skip to content

Commit

Permalink
fix: update @testing-library/user-event syntax for v14
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Aug 13, 2023
1 parent 2aa9365 commit f1a0055
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ describe('HelloWorld', () => {

describe('when the user types in a new greeting', () => {
it('changes to render that one', async () => {
const user = userEvent.setup();

const { container } = render(
<HelloWorld initialGreeting="Hello Ackama" />
);

await userEvent.type(
await user.type(
screen.getByRole('textbox', {
name: /change the greeting/iu
}),
Expand All @@ -27,11 +29,13 @@ describe('HelloWorld', () => {
});

it('can be reset back to the initial greeting', async () => {
const user = userEvent.setup();

const { container } = render(
<HelloWorld initialGreeting="Hello Ackama" />
);

await userEvent.type(
await user.type(
screen.getByRole('textbox', {
name: /change the greeting/iu
}),
Expand All @@ -40,7 +44,7 @@ describe('HelloWorld', () => {

expect(container).not.toHaveTextContent('Hello Ackama');

await userEvent.click(screen.getByText('Reset'));
await user.click(screen.getByText('Reset'));

expect(container).toHaveTextContent('Hello Ackama');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('HelloWorld', () => {
describe('when the user types in a new greeting', () => {
it('changes to render that one', async () => {
const user = userEvent.setup();

const { container } = render(
<HelloWorld initialGreeting="Hello Ackama" />
);
Expand Down

0 comments on commit f1a0055

Please sign in to comment.