Permalink
Browse files

readonly support

  • Loading branch information...
1 parent 99c54cf commit 48185aa0732ac94fdf3e1216404caa9bcf2508a8 @twalpole committed Mar 9, 2013
Showing with 5 additions and 4 deletions.
  1. +3 −3 lib/capybara/rack_test/node.rb
  2. +2 −1 lib/capybara/selenium/node.rb
@@ -27,7 +27,7 @@ def set(value)
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 @@ def selected?
def disabled?
string_node.disabled?
end
-
+
def path
native.path
end
@@ -160,7 +160,7 @@ def set_input(value)
end
native.remove
else
- native['value'] = value.to_s
+ native['value'] = value.to_s unless self[:readonly]
end
end
@@ -37,7 +37,8 @@ def set(value)
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

0 comments on commit 48185aa

Please sign in to comment.