comparison 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
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
681 // after leaving the field. 681 // after leaving the field.
682 $value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value; 682 $value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value;
683 } 683 }
684 684
685 $element->postValue(array('value' => array($value))); 685 $element->postValue(array('value' => array($value)));
686 $this->trigger($xpath, 'change'); 686 // Remove the focus from the element if the field still has focus in
687 // order to trigger the change event. By doing this instead of simply
688 // triggering the change event for the given xpath we ensure that the
689 // change event will not be triggered twice for the same element if it
690 // has lost focus in the meanwhile. If the element has lost focus
691 // already then there is nothing to do as this will already have caused
692 // the triggering of the change event for that element.
693 $script = <<<JS
694 var node = {{ELEMENT}};
695 if (document.activeElement === node) {
696 document.activeElement.blur();
697 }
698 JS;
699 $this->executeJsOnElement($element, $script);
687 } 700 }
688 701
689 /** 702 /**
690 * {@inheritdoc} 703 * {@inheritdoc}
691 */ 704 */