Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 29, 2022
1 parent 8413ab1 commit 5c01bf7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/test/PreferredLanguages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,32 @@ describe( 'PreferredLanguages', () => {
const spinner = container.querySelector( '.language-install-spinner' );
expect( spinner ).toBeInTheDocument();
} );

it( 'does not add a spinner if there is no matching submit button', async () => {
const { container } = render(
<PreferredLanguages
allLanguages={ [ de_DE, es_ES, fr_FR ] }
preferredLanguages={ [ es_ES ] }
/>,
{
wrapper: ( { children } ) => (
<form onSubmit={ ( e ) => e.preventDefault() }>
{ children }
<input
type="submit"
id="anothersubmit"
value="Submit"
/>
</form>
),
}
);

const submitButton = screen.getByRole( 'button', { name: 'Submit' } );
await userEvent.click( submitButton );
const spinner = container.querySelector( '.language-install-spinner' );
expect( spinner ).not.toBeInTheDocument();
} );
} );

/* eslint-enable camelcase */

0 comments on commit 5c01bf7

Please sign in to comment.