Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!