Skip to content

Commit

Permalink
MDL-58948 behat: return the result of the pending JS method
Browse files Browse the repository at this point in the history
This increases compatibility with other Mink drivers,
in particular, the Chrome Mink Driver.
  • Loading branch information
polothy committed Jun 28, 2017
1 parent f4a2d69 commit 5536bf4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/behat/behat_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ public function wait_for_pending_js() {
$pending = '';
try {
$jscode = '
return function() {
return (function() {
if (typeof M === "undefined") {
if (document.readyState === "complete") {
return "";
Expand All @@ -741,7 +741,7 @@ public function wait_for_pending_js() {
} else {
return "incomplete"
}
}();';
}());';
$pending = $this->getSession()->evaluateScript($jscode);
} catch (NoSuchWindow $nsw) {
// We catch an exception here, in case we just closed the window we were interacting with.
Expand Down

0 comments on commit 5536bf4

Please sign in to comment.