MDL-52970 behat: don't set select value if already set

In FF 44.0, it fails to click on submit button if
select value is set to the original value
This commit is contained in:
Rajesh Taneja
2016-02-19 15:24:45 +08:00
parent 8d42058734
commit 86ebfb0bb5
@@ -78,6 +78,17 @@ class behat_form_select extends behat_form_field {
$afterfirstoption = true;
}
} else {
// If value is already set then don't set it again.
if ($this->field->getValue() == $value) {
return;
} else {
$opt = $this->field->find('named', array(
'option', $this->field->getSession()->getSelectorsHandler()->xpathLiteral($value)
));
if ($opt && ($this->field->getValue() == $opt->getValue())) {
return;
}
}
// This is a single select, let's pass the last one specified.
$this->field->selectOption(end($options));
}