Skip to content

Can't use fireEvent.update on a standard input field with Vuelidate #178

Closed
@kinoli

Description

@kinoli

I'm not sure if this is vuelidate related or not but fireEvent.update doesn't seem to work on a standard input field. I can fix it by updating vue-testing-library.js to change the fireEvent.input to fireEvent.change

Such as on line 247.

    case 'INPUT':
      {
        if (['checkbox', 'radio'].includes(type)) {
          elem.checked = true;
          return fireEvent.change(elem);
        } else {
          elem.value = value;
          return fireEvent.input(elem);
        }
      }

to

    case 'INPUT':
      {
        if (['checkbox', 'radio'].includes(type)) {
          elem.checked = true;
          return fireEvent.change(elem);
        } else {
          elem.value = value;
          return fireEvent.change(elem);
        }
      }

The above change fixes the issue. Any chance we can use change instead of input. Perhaps there's a bug with the input function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions