You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2021/01/28 00:02:44 UTC

[myfaces-tobago] branch tobago-4.x updated: fix: qunit tests ware broken, because of different JS init after Deltaspike JS update

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch tobago-4.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-4.x by this push:
     new 3603777  fix: qunit tests ware broken, because of different JS init after Deltaspike JS update
3603777 is described below

commit 36037774fb290c70128199e77210114b074f30d2
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Jan 27 17:46:21 2021 +0100

    fix: qunit tests ware broken, because of different JS init after Deltaspike JS update
---
 .../tobago-example-demo/src/main/webapp/script/tobago-test.js     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js b/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js
index efe60cb..c686d2c 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/script/tobago-test.js
@@ -29,12 +29,10 @@ QUnit.test("wait for test", function (assert) {
   var done = assert.async();
 
   var startTime = new Date().getTime();
-  var contentWindowName = "";
-  var waitingDone = false;
   var interval = setInterval(function () {
-    contentWindowName = document.getElementById("page:testframe").contentWindow.name;
-    waitingDone = (contentWindowName !== "page:testframe" && contentWindowName !== "ds-tempWindowId")
-        || new RegExp('[\?&]base=([^&#]*)').exec(window.location.href)[1].indexOf("error%2F") === 0;
+    // checks every 50 ms, if the document is ready loaded (max 20 s)
+    var readyState = document.getElementById("page:testframe").contentWindow.document.readyState;
+    var waitingDone = readyState === "complete";
     if (new Date().getTime() - startTime >= 20000 || waitingDone) {
       clearInterval(interval);
       assert.ok(waitingDone);