1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

fieldset elements should correctly respond to disabled?

This commit is contained in:
Thomas Walpole 2018-06-27 10:19:47 -07:00
parent 928466d0eb
commit 04a9806167
3 changed files with 10 additions and 2 deletions

View file

@ -140,7 +140,10 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
alias :checked? :selected?
def disabled?
!native.enabled?
return true unless native.enabled?
# WebDriver only defines `disabled?` for form controls but fieldset makes sense too
return boolean_attr(self[:disabled]) if tag_name == 'fieldset'
false
end
def content_editable?

View file

@ -177,6 +177,11 @@ Capybara::SpecHelper.spec "node" do
expect(@session.find('//option', text: "A.2")).not_to be_disabled
end
it "should see a disabled fieldset as disabled" do
@session.visit('/form')
expect(@session.find(:css, '#form_disabled_fieldset')).to be_disabled
end
context "in a disabled fieldset" do
# https://html.spec.whatwg.org/#the-fieldset-element
it "should see elements not in first legend as disabled" do

View file

@ -386,7 +386,7 @@ New line after and before textarea tag
<p>
<fieldset disabled="disabled">
<fieldset disabled="disabled" id="form_disabled_fieldset">
<legend>Disabled Child</legend>
<input name="form[disabled_fieldset_child]" id="form_disabled_fieldset_child"/>
<select>