NoelOConnell / quill-image-uploader

A module for Quill rich text editor to allow images to be uploaded to a server instead of being base64 encoded
MIT License
243 stars 98 forks source link

Allow configurable data-testid attribute on file input #90

Open emilong opened 1 year ago

emilong commented 1 year ago

Automated test runners such as Cypress cannot interact with system dialogs such as the file selection dialog box. In order to allow testing this module, this change does two things:

  1. It does not remove the input from the DOM until the file has changed. Previously it was removed on the next animation frame, but now it's removed in the onchange handler. For actual human interaction, this change should behave equivalently, but for test runners it gives them a chance to find and upload a file to the file input.
  2. There is a configurable data-testid attribute for the file input. This data attribute is a common one for test frameworks and allows them to find the input easily.