Ensure the attribute exists before returning its value
This commit is contained in:
parent
7ace6dce54
commit
3c8ad255ad
|
@ -12,7 +12,11 @@ module Capybara::Webkit
|
|||
if name == 'checked' || name == 'disabled' || name == 'multiple'
|
||||
value == 'true'
|
||||
else
|
||||
value
|
||||
if invoke("hasAttribute", name) == 'true'
|
||||
value
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -773,7 +773,7 @@ describe Capybara::Webkit::Driver do
|
|||
end
|
||||
|
||||
it "does not modify the selected attribute of a new selection" do
|
||||
monkey_option['selected'].should be_empty
|
||||
monkey_option['selected'].should be_nil
|
||||
end
|
||||
|
||||
it "returns the old value when a reset button is clicked" do
|
||||
|
|
|
@ -64,6 +64,10 @@ Capybara = {
|
|||
}
|
||||
},
|
||||
|
||||
hasAttribute: function(index, name) {
|
||||
return this.nodes[index].hasAttribute(name);
|
||||
},
|
||||
|
||||
path: function(index) {
|
||||
return "/" + this.getXPathNode(this.nodes[index]).join("/");
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue