Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda