Skip to content

Selecting multiple options using selectOptions is not working #935

@Thanga-Ganapathy

Description

@Thanga-Ganapathy

Reproduction example

https://codesandbox.io/s/pedantic-robinson-cchucu?file=/src/App.js

Prerequisites

  1. Render a form with submit button using the Form component from "@open-tech-world/react-form".
  2. Render a select element using the SelectField from "@open-tech-world/react-form".
  3. Add some options to the select and add multiple attribute.
  4. Select options using userEvent.selectOptions.
  5. Fire click event to the submit button.
  6. Check the form values returned from the Form onSubmit handler.

Expected behavior

The userEvent.selectOptions should select multiple options using the provided string array of the values parameter.

Actual behavior

The userEvent.selectOptions selects only the last option from the given string array of the values parameter, even if the multiple attribute is set.

User-event version

14.1.1

Environment

Testing Library framework: @testing-library/[email protected]

JS framework: [email protected]

Test environment: [email protected]

DOM implementation: @testing-library/[email protected]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions