1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

readonly support

This commit is contained in:
Thomas Walpole 2013-03-09 13:42:35 -08:00
parent 99c54cf152
commit 48185aa073
2 changed files with 5 additions and 4 deletions

View file

@ -27,7 +27,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
elsif input_field?
set_input(value)
elsif textarea?
native.content = value.to_s
native.content = value.to_s unless self[:readonly]
end
end
@ -75,7 +75,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
def disabled?
string_node.disabled?
end
def path
native.path
end
@ -160,7 +160,7 @@ private
end
native.remove
else
native['value'] = value.to_s
native['value'] = value.to_s unless self[:readonly]
end
end

View file

@ -37,7 +37,8 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
path_names = value.to_s.empty? ? [] : value
native.send_keys(*path_names)
elsif tag_name == 'textarea' or tag_name == 'input'
driver.browser.execute_script "arguments[0].value = ''", native
#script can change a readonly element which user input cannot, so dont execute if readonly
driver.browser.execute_script "arguments[0].value = ''", native unless self[:readonly]
native.send_keys(value.to_s)
end
end