Raise error when attempting to set a readonly field
This commit is contained in:
parent
05945bf2d9
commit
98b9034842
|
@ -97,6 +97,8 @@ module Capybara
|
|||
def set(value, options={})
|
||||
options ||= {}
|
||||
|
||||
raise Capybara::ReadOnlyElementError, "Attempt to set readonly element with value: #{value}" if readonly?
|
||||
|
||||
driver_supports_options = (base.method(:set).arity != 1)
|
||||
|
||||
unless options.empty? || driver_supports_options
|
||||
|
|
|
@ -225,9 +225,7 @@ private
|
|||
end
|
||||
|
||||
def set_text(value, options)
|
||||
if readonly?
|
||||
warn "Attempt to set readonly element with value: #{value} \n *This will raise an exception in a future version of Capybara"
|
||||
elsif value.to_s.empty? && options[:clear].nil?
|
||||
if value.to_s.empty? && options[:clear].nil?
|
||||
native.clear
|
||||
else
|
||||
if options[:clear] == :backspace
|
||||
|
|
Loading…
Reference in New Issue