mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Added disabled? to the node
This commit is contained in:
parent
b375a1c988
commit
7ec047e208
4 changed files with 40 additions and 0 deletions
|
@ -142,6 +142,16 @@ module Capybara
|
|||
synchronize { base.selected? }
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
# Whether or not the element is disabled.
|
||||
#
|
||||
# @return [Boolean] Whether the element is disabled
|
||||
#
|
||||
def disabled?
|
||||
synchronize { base.disabled? }
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
# An XPath expression describing where on the page the element can be found
|
||||
|
|
|
@ -68,6 +68,10 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
|
|||
string_node.selected?
|
||||
end
|
||||
|
||||
def disabled?
|
||||
string_node.disabled?
|
||||
end
|
||||
|
||||
def path
|
||||
native.path
|
||||
end
|
||||
|
|
|
@ -81,6 +81,15 @@ Capybara::SpecHelper.spec "node" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#disabled?" do
|
||||
it "should extract disabled node" do
|
||||
@session.visit('/form')
|
||||
@session.find('//input[@id="customer_name"]').should be_disabled
|
||||
@session.find('//input[@id="customer_age"]').should be_disabled
|
||||
@session.find('//input[@id="customer_email"]').should_not be_disabled
|
||||
end
|
||||
end
|
||||
|
||||
describe "#visible?" do
|
||||
it "should extract node visibility" do
|
||||
@session.first('//a').should be_visible
|
||||
|
|
|
@ -9,8 +9,25 @@
|
|||
<option>Mr</option>
|
||||
<option>Miss</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="customer_name">Customer Name
|
||||
<input type="text" name="form[customer_name]" value="Blah" id="customer_name" disabled="disabled"/>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="customer_age">Customer Age
|
||||
<input type="text" name="form[customer_age]" value="33" id="customer_age" disabled=""/>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="customer_email">Customer Email
|
||||
<input type="text" name="form[customer_email]" value="ben@ben.com" id="customer_email"/>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="form_other_title">Other title</label>
|
||||
|
|
Loading…
Reference in a new issue