mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Don't clear readonly text fields when set
This commit is contained in:
parent
a5c51b23bd
commit
136e0e2bb7
3 changed files with 12 additions and 1 deletions
|
@ -773,6 +773,7 @@ describe Capybara::Webkit::Driver do
|
|||
<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 @@ describe Capybara::Webkit::Driver do
|
|||
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
|
||||
|
|
|
@ -9,6 +9,7 @@ describe Capybara::Webkit, 'compatibility with selenium' do
|
|||
<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 @@ describe Capybara::Webkit, 'compatibility with selenium' do
|
|||
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
|
||||
|
|
|
@ -242,7 +242,9 @@ Capybara = {
|
|||
length = value.length;
|
||||
}
|
||||
|
||||
if (!node.readOnly)
|
||||
node.value = "";
|
||||
|
||||
for (strindex = 0; strindex < length; strindex++) {
|
||||
CapybaraInvocation.keypress(value[strindex]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue