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

235
Visualizações
How to select an option in MUI select list with jest?

I have a Material UI select component id like to automate tests with jest. Is it possible to select an option within a list selector Material UI component and have the option populate its value confirmably in jest? I am unable to find any reliable method or information on how to do this.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

In MUI library all input components have a property called inputProps. This property is forwarded to the html <input /> at the end of the tree. So you can pass a property that identifies the input so you can use it to find and interact with it.

about 4 years ago · Juan Pablo Isaza Relatório

0

MUI isn't that different.

Have you tried something like this?

import {render, screen, fireEvent} from '@testing-library/react'

test('should pick select option', () => {
  render(<MyCustomMUIComponent />)
  const select = screen.getByLabelText('My Select');
  fireEvent.click(select);
  const option = screen.getByText('First Option');
  fireEvent.click(option);

  // the effect you want to test for
})
about 4 years ago · Juan Pablo Isaza Relatório
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