diff vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php	Thu Apr 26 11:26:54 2018 +0100
+++ b/vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php	Tue Jul 10 15:07:59 2018 +0100
@@ -683,7 +683,20 @@
         }
 
         $element->postValue(array('value' => array($value)));
-        $this->trigger($xpath, 'change');
+        // Remove the focus from the element if the field still has focus in
+        // order to trigger the change event. By doing this instead of simply
+        // triggering the change event for the given xpath we ensure that the
+        // change event will not be triggered twice for the same element if it
+        // has lost focus in the meanwhile. If the element has lost focus
+        // already then there is nothing to do as this will already have caused
+        // the triggering of the change event for that element.
+        $script = <<<JS
+var node = {{ELEMENT}};
+if (document.activeElement === node) {
+  document.activeElement.blur();
+}
+JS;
+        $this->executeJsOnElement($element, $script);
     }
 
     /**