Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't clear readonly text fields when set

  • Loading branch information...
commit 136e0e2bb7aee35db746edba92ec551af5942c3f 1 parent a5c51b2
@mhoran mhoran authored
View
7 spec/driver_spec.rb
@@ -773,6 +773,7 @@ def visit(url, driver=driver)
<input type="text" name="foo" value="bar"/>
<input type="text" name="maxlength_foo" value="bar" maxlength="10"/>
<input type="text" id="disabled_input" disabled="disabled"/>
+ <input type="text" id="readonly_input" readonly="readonly" value="readonly"/>
<input type="checkbox" name="checkedbox" value="1" checked="checked"/>
<input type="checkbox" name="uncheckedbox" value="2"/>
<select name="animal">
@@ -981,6 +982,12 @@ def visit(url, driver=driver)
it "knows a not disabled input is not disabled" do
enabled_input['disabled'].should_not be_true
end
+
+ it "does not modify a readonly input" do
+ readonly_input = driver.find_css("#readonly_input").first
+ readonly_input.set('enabled')
+ readonly_input.value.should == 'readonly'
+ end
end
context "dom events" do
View
2  spec/selenium_compatibility_spec.rb
@@ -9,6 +9,7 @@
<form onsubmit="return false">
<label for="one">One</label><input type="text" name="one" id="one" />
<label for="two">Two</label><input type="text" name="two" id="two" />
+ <label for="three">Three</label><input type="text" name="three" id="three" readonly="readonly" />
<input type="submit" value="Submit" id="submit" />
</form>
<script type="text/javascript">
@@ -33,6 +34,7 @@
fill_in "One", :with => "some value"
fill_in "One", :with => "a new value"
fill_in "Two", :with => "other value"
+ fill_in "Three", :with => "readonly value"
click_button "Submit"
end
end
View
4 src/capybara.js
@@ -242,7 +242,9 @@ Capybara = {
length = value.length;
}
- node.value = "";
+ if (!node.readOnly)
+ node.value = "";
+
for (strindex = 0; strindex < length; strindex++) {
CapybaraInvocation.keypress(value[strindex]);
}
Please sign in to comment.
Something went wrong with that request. Please try again.