Skip to content
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
Do not use data-testid
  • Loading branch information
tyxla committed Sep 12, 2022
commit 3cda9b5cac05673a60dcca4b0ed482da5b0cc28e
14 changes: 7 additions & 7 deletions packages/components/src/isolated-event-container/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ describe( 'IsolatedEventContainer', () => {
const clickHandler = jest.fn();
render(
<IsolatedEventContainer
data-testid="container"
title="Container"
className="test"
onClick={ clickHandler }
/>
);

const container = screen.getByTestId( 'container' );
const container = screen.getByTitle( 'Container' );
expect( container ).toHaveClass( 'test' );

await user.click( container );
Expand All @@ -34,13 +34,13 @@ describe( 'IsolatedEventContainer', () => {

it( 'should render children', async () => {
render(
<IsolatedEventContainer data-testid="container">
<p data-testid="child" />
<IsolatedEventContainer title="Container">
<p>Child</p>
</IsolatedEventContainer>
);

expect(
within( screen.getByTestId( 'container' ) ).getByTestId( 'child' )
within( screen.getByTitle( 'Container' ) ).getByText( 'Child' )
).toBeVisible();
} );

Expand All @@ -56,11 +56,11 @@ describe( 'IsolatedEventContainer', () => {
onMouseDown={ mousedownHandler }
onKeyDown={ keydownHandler }
>
<IsolatedEventContainer data-testid="container" />
<IsolatedEventContainer title="Container" />
</button>
);

const container = screen.getByTestId( 'container' );
const container = screen.getByTitle( 'Container' );

await user.click( container );
await user.keyboard( '[Enter]' );
Expand Down