MDL-54589 behat: Trigger change event after selecting option

After selecting option, some browsers need
explicit change event
This commit is contained in:
Rajesh Taneja
2016-06-20 09:59:59 +08:00
parent a7221c5f19
commit 5f738b0be5
2 changed files with 3 additions and 3 deletions
+2 -3
View File
@@ -71,10 +71,9 @@ class behat_form_select extends behat_form_field {
// Wait for all the possible AJAX requests that have been
// already triggered by selectOption() to be finished.
if ($this->running_javascript()) {
// Trigger change event as this is needed by some drivers (Phantomjs). Don't do it for
// Trigger change event as this is needed by some drivers (Phantomjs, Mac-FF). Don't do it for
// Singleselect as this will cause multiple event fire and lead to race-around condition.
$browser = \Moodle\BehatExtension\Driver\MoodleSelenium2Driver::getBrowser();
if (!$singleselect && ($browser == 'phantomjs')) {
if (!$singleselect) {
$script = "Syn.trigger('change', {}, {{ELEMENT}})";
try {
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
@@ -40,6 +40,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I wait until the page is ready
And I press "Save changes"
And I press "Ok"
And I click on "Edit settings" "link"