-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Support time inputs #245
base: main
Are you sure you want to change the base?
Support time inputs #245
Conversation
I am not sure why the tests are failing. They are all failing for me locally on the main branch as well. |
I am interested in following up this contribution as well. @route Not sure if you are the project's maintainer, but could you give us some insights if you know why all the tests are falling please? |
44bc276
to
85b71ef
Compare
I have just rebased my changes onto the latest main branch. |
Just approved them to run |
Weird, dunno let me release new Ferrum and push my changes to cuprite and I'll get this into new release |
lib/capybara/cuprite/node.rb
Outdated
when "time" | ||
value = value.strftime("%H:%M") if value.is_a?(Time) | ||
node.evaluate("this.setAttribute('value', '#{value}')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest changing lib/capybara/cuprite/javascripts/index.js
to:
} else if (node.type == "time") {
this.setValue(node, value);
this.input(node);
when "time" | |
value = value.strftime("%H:%M") if value.is_a?(Time) | |
node.evaluate("this.setAttribute('value', '#{value}')") | |
when "time" | |
value = value.strftime("%H:%M") if value.is_a?(Time) | |
command(:set, value.to_s) |
This way, input event will be emitted correctly and value
attribute won't be modified unnecessarily.
Need this. +1 👀 |
Do not modify time input value in JS Extract time inputs to seperate test file The test inputs load a data attribute for an SVG icon. This is changing the count of network requests in unrelated tests. Add support for week and month inputs
d3336eb
to
d6f20e3
Compare
@route I have revisited this PR and cleaned it up. The issue with the original failing tests was that loading SVG icons for time and date inputs and this was increasing the count of network requests. I have moved the time and date tests to a new HTML file and this has resolved the problem. I have also added support for month and week inputs. It seems the test suite is failing on Ruby 3.0 and Ruby 3.2. I have been unable to replicate these failures locally. |
I am converting a project over from capybara selenium and found that time inputs were failing to be correctly set.
This allows specifying the time as a string or a Time object. The date attributes will be ignored.
I have added test cases for both string and time. I also added some test cases for date inputs as well.