Skip to content

Commit

Permalink
Remove unnecessary fireEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Oct 17, 2022
1 parent 04d0e83 commit d9daf50
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { render, fireEvent, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';

/**
* WordPress dependencies
Expand All @@ -22,7 +22,7 @@ class Test extends Component {
data-testid="test-element"
data-focus-history={ focusHistory }
>
<textarea />
<textarea aria-label="Textarea" />
</div>
);
}
Expand Down Expand Up @@ -89,10 +89,11 @@ describe( 'withFocusReturn()', () => {
),
} );

const textarea = container.querySelector( 'textarea' );
fireEvent.focusIn( textarea, { target: textarea } );
textarea.focus();
expect( textarea ).toHaveFocus();
screen
.getByRole( 'textbox', {
name: 'Textarea',
} )
.focus();

// Should return to the activeElement saved with this component.
unmount();
Expand Down

0 comments on commit d9daf50

Please sign in to comment.