mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Ensure keystrokes are sent when Selenium::Node#set is passed a String for date/time fields
This commit is contained in:
parent
412a308317
commit
64ce735de5
2 changed files with 10 additions and 3 deletions
|
@ -10,6 +10,13 @@ Release date: unreleased
|
|||
* New global configuration `default_set_options` used in `Capybara::Node::Element#set` as default `options` hash [Champier Cyril]
|
||||
* `execute_javascript` and `evaluate_javascript` can now be called on elements to run the JS in the context of the element [Thomas Walpole]
|
||||
|
||||
# Version 3.1.1
|
||||
Release date: unreleased
|
||||
|
||||
### Fixes
|
||||
|
||||
* Ensure keystrokes are sent when setting time/date fields to a string with the Selenium driver [Thomas Walpole]
|
||||
|
||||
# Version 3.1.0
|
||||
Release date: 2018-05-10
|
||||
|
||||
|
|
|
@ -238,19 +238,19 @@ private
|
|||
end
|
||||
|
||||
def set_date(value) # rubocop:disable Naming/AccessorMethodName
|
||||
return set_text(value) unless value.respond_to?(:to_date)
|
||||
return set_text(value) if value.is_a?(String) || !value.respond_to?(:to_date)
|
||||
# TODO: this would be better if locale can be detected and correct keystrokes sent
|
||||
update_value_js(value.to_date.strftime('%Y-%m-%d'))
|
||||
end
|
||||
|
||||
def set_time(value) # rubocop:disable Naming/AccessorMethodName
|
||||
return set_text(value) unless value.respond_to?(:to_time)
|
||||
return set_text(value) if value.is_a?(String) || !value.respond_to?(:to_time)
|
||||
# TODO: this would be better if locale can be detected and correct keystrokes sent
|
||||
update_value_js(value.to_time.strftime('%H:%M'))
|
||||
end
|
||||
|
||||
def set_datetime_local(value) # rubocop:disable Naming/AccessorMethodName
|
||||
return set_text(value) unless value.respond_to?(:to_time)
|
||||
return set_text(value) if value.is_a?(String) || !value.respond_to?(:to_time)
|
||||
# TODO: this would be better if locale can be detected and correct keystrokes sent
|
||||
update_value_js(value.to_time.strftime('%Y-%m-%dT%H:%M'))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue