1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

Enabled options in disabled selects are disabled

This is the behavior of Selenium and has been standardized in Capybara.
This commit is contained in:
Matthew Horan 2013-03-21 09:40:06 -04:00
parent 8be4f316c5
commit f8731b692a
2 changed files with 12 additions and 1 deletions

View file

@ -92,7 +92,11 @@ module Capybara::Webkit
end
def disabled?
self['disabled']
if %w(option optgroup).include? tag_name
self['disabled'] || find_xpath("parent::*")[0].disabled?
else
self['disabled']
end
end
def path

View file

@ -780,6 +780,9 @@ describe Capybara::Webkit::Driver do
<option id="select-option-monkey">Monkey</option>
<option id="select-option-capybara" selected="selected">Capybara</option>
</select>
<select name="disabled" disabled="disabled">
<option id="select-option-disabled">Disabled</option>
</select>
<select name="toppings" multiple="multiple">
<optgroup label="Mediocre Toppings">
<option selected="selected" id="topping-apple">Apple</option>
@ -988,6 +991,10 @@ describe Capybara::Webkit::Driver do
readonly_input.set('enabled')
readonly_input.value.should == 'readonly'
end
it "should see enabled options in disabled select as disabled" do
driver.find_css("#select-option-disabled").first.should be_disabled
end
end
context "dom events" do