mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Ignore disabled fields and buttons, closes #771
This commit is contained in:
parent
9c0093a06a
commit
dd805d639b
8 changed files with 42 additions and 1 deletions
|
@ -23,6 +23,8 @@
|
|||
* `find` now raises an error if more than one element was found. Since `find` is
|
||||
used by most actions, like `click_link` under the surface, this means that all
|
||||
actions need to unambiguous in the future. [Jonas Nicklas]
|
||||
* All methods which find or manipulate fields or buttons now ignore them when
|
||||
they are disabled. [Jonas Nicklas]
|
||||
* `Element#text` on RackTest now only returns visible text and normalizes
|
||||
(strips) whitespace, as with Selenium [Mark Dodwell, Jo Liss]
|
||||
* `has_content?` now checks the text value returned by `Element#text`, as opposed to
|
||||
|
|
|
@ -74,4 +74,12 @@ Capybara::SpecHelper.spec "#check" do
|
|||
end.should raise_error(Capybara::ElementNotFound, msg)
|
||||
end
|
||||
end
|
||||
|
||||
context "with a disabled checkbox" do
|
||||
it "should raise an error" do
|
||||
running do
|
||||
@session.check('Disabled Checkbox')
|
||||
end.should raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,4 +29,12 @@ Capybara::SpecHelper.spec "#choose" do
|
|||
end.should raise_error(Capybara::ElementNotFound, msg)
|
||||
end
|
||||
end
|
||||
|
||||
context "with a disabled radio button" do
|
||||
it "should raise an error" do
|
||||
running do
|
||||
@session.choose('Disabled Radio')
|
||||
end.should raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -302,6 +302,12 @@ Capybara::SpecHelper.spec '#click_button' do
|
|||
@session.should have_content('Postback')
|
||||
end
|
||||
|
||||
it "ignores disabled buttons" do
|
||||
expect do
|
||||
@session.click_button('Disabled button')
|
||||
end.to raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
|
||||
it "should encode complex field names, like array[][value]" do
|
||||
@session.visit('/form')
|
||||
@session.fill_in('address1_city', :with =>'Paris')
|
||||
|
|
|
@ -130,4 +130,12 @@ Capybara::SpecHelper.spec "#fill_in" do
|
|||
end.should raise_error(Capybara::ElementNotFound, msg)
|
||||
end
|
||||
end
|
||||
|
||||
context "on a disabled field" do
|
||||
it "should raise an error" do
|
||||
running do
|
||||
@session.fill_in('Disabled Text Field', :with => 'Blah blah')
|
||||
end.should raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,6 +77,14 @@ Capybara::SpecHelper.spec "#select" do
|
|||
end
|
||||
end
|
||||
|
||||
context "on a disabled select" do
|
||||
it "should raise an error" do
|
||||
running do
|
||||
@session.select('Should not see me', :from => 'Disabled Select')
|
||||
end.should raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
context "with multiple select" do
|
||||
it "should return an empty value" do
|
||||
@session.find_field('Language').value.should == []
|
||||
|
|
|
@ -253,6 +253,7 @@
|
|||
<button type="submit" id="click_me_123" title="Click Title button" value="click_me">Click me!</button>
|
||||
<button type="submit" name="form[no_value]">No Value!</button>
|
||||
<button id="no_type">No Type!</button>
|
||||
<input type="button" disabled value="Disabled button"/>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
|
2
xpath
2
xpath
|
@ -1 +1 @@
|
|||
Subproject commit 6873e1655e1945b624673956a0595e64b865d64a
|
||||
Subproject commit ee35f7b383f590680b55a191f89a31e9ae06c615
|
Loading…
Add table
Reference in a new issue