mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Merge branch 'MDL-69360-39' of git://github.com/NoelDeMartin/moodle into MOODLE_39_STABLE
This commit is contained in:
commit
8eca15c5f1
1 changed files with 13 additions and 13 deletions
|
@ -91,8 +91,12 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
|||
|
||||
/**
|
||||
* The JS code to check that the page is ready.
|
||||
*
|
||||
* The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.
|
||||
*/
|
||||
const PAGE_READY_JS = '(typeof M !== "undefined" && M.util && M.util.pending_js && !Boolean(M.util.pending_js.length)) && (document.readyState === "complete")';
|
||||
const PAGE_READY_JS = "document.readyState === 'complete' && " .
|
||||
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
|
||||
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)";
|
||||
|
||||
/**
|
||||
* Locates url, based on provided path.
|
||||
|
@ -818,19 +822,15 @@ EOF;
|
|||
try {
|
||||
$jscode = trim(preg_replace('/\s+/', ' ', '
|
||||
return (function() {
|
||||
if (typeof M === "undefined") {
|
||||
if (document.readyState === "complete") {
|
||||
return "";
|
||||
} else {
|
||||
return "incomplete";
|
||||
}
|
||||
} else if (' . self::PAGE_READY_JS . ') {
|
||||
return "";
|
||||
} else if (typeof M.util !== "undefined") {
|
||||
return M.util.pending_js.join(":");
|
||||
} else {
|
||||
return "incomplete"
|
||||
if (document.readyState !== "complete") {
|
||||
return "incomplete";
|
||||
}
|
||||
|
||||
if (typeof M !== "object" || typeof M.util !== "object" || typeof M.util.pending_js === "undefined") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return M.util.pending_js.join(":");
|
||||
})()'));
|
||||
$pending = self::evaluate_script_in_session($session, $jscode);
|
||||
} catch (NoSuchWindow $nsw) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue