From 5536bf4f22cc2f246252cb0cd5045a8a5bc937f9 Mon Sep 17 00:00:00 2001 From: Mark Nielsen Date: Wed, 28 Jun 2017 11:20:49 -0700 Subject: [PATCH] MDL-58948 behat: return the result of the pending JS method This increases compatibility with other Mink drivers, in particular, the Chrome Mink Driver. --- lib/behat/behat_base.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php index d01213b4fec..b39da2c28d2 100644 --- a/lib/behat/behat_base.php +++ b/lib/behat/behat_base.php @@ -727,7 +727,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { $pending = ''; try { $jscode = ' - return function() { + return (function() { if (typeof M === "undefined") { if (document.readyState === "complete") { return ""; @@ -741,7 +741,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { } 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.