Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a color input doesn't fire the change or input events #229

Open
asilano opened this issue Apr 17, 2023 · 0 comments · May be fixed by #230
Open

Setting a color input doesn't fire the change or input events #229

asilano opened this issue Apr 17, 2023 · 0 comments · May be fixed by #230

Comments

@asilano
Copy link

asilano commented Apr 17, 2023

Given HTML like:

<input type="color" id="control" onchange="document.getElementById('monitor').innerHTML = 'changed'"/>
<div id="monitor"></div>

Then the following test will fail:

fill_in("control", with: "#c0ffee")
expect(page).to have_content("changed")

This is because the set method for a color input only forces the value via JavaScript; it doesn't trigger the change or input events.

I have a fix for this; PR incoming.

asilano added a commit to asilano/cuprite that referenced this issue Apr 17, 2023
Since a color input has to have its value set directly via javascript
(presumably because of the difficulty of interacting with the browser's
colour picker), the `change` and `input` events don't automatically
happen. This PR fires them manually.

Fixes rubycdp#229
@asilano asilano linked a pull request Apr 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant