Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
Test if an element was focused at least once using Jest and Testing Library

I'm trying to test a React component that should focus all the fields having certain ids at least once, using Jest and Testing Library. For example, if the rendered components are:

import { render } from '@testing-library/react';

const { container } = render(
    <div >
        <input id='input1' />
        <input id='input2' />
        <FocusCertainFieldsAtLeastOnce />
    <div />
);

I need to test if <FocusCertainFieldsAtLeastOnce /> is being able to focus both <input /> elements with ids 'input1' and 'input2' at least once.

I'm aware how to achieve this using Jest and Enzyme and want something similar to this answer but using Jest and Testing Library instead.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda