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 2019/07/26 07:30:53 UTC

[myfaces-tobago] 03/04: TOBAGO-1633: TS refactoring: fix integration tests

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

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

commit 2d7f23ac9bc57eb50300c00c799f146aa15777f9
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Jul 25 17:01:31 2019 +0200

    TOBAGO-1633: TS refactoring: fix integration tests
    
    * fix Suggest.test
    * fix TobagoTestTool.waitMs()
---
 .../content/20-component/010-input/20-suggest/Suggest.test.js  | 10 +++++++---
 .../META-INF/resources/tobago/test/tobago-test-tool.js         |  4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/Suggest.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/Suggest.test.js
index 0606de7..6989b7c 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/Suggest.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/Suggest.test.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import {jQueryFrameFn} from "/script/tobago-test.js";
+import {jQueryFrame, jQueryFrameFn} from "/script/tobago-test.js";
 import {TobagoTestTool} from "/tobago/test/tobago-test-tool.js";
 
 QUnit.test("Basics: 'M'", function (assert) {
@@ -57,7 +57,7 @@ function testMarsBasics(assert, inputString, expectedLength) {
   TTT.waitForResponse();
   TTT.asserts(expectedLength + 1, function () {
     assert.equal(suggestionsFn().length, expectedLength);
-    for (i = 0; i < expectedLength; i++) {
+    for (let i = 0; i < expectedLength; i++) {
       assert.ok(suggestionsFn().eq(i).find("strong").text().toUpperCase().indexOf(inputString.toUpperCase()) >= 0);
     }
   });
@@ -148,7 +148,11 @@ QUnit.test("Client side: 'Ju'", function (assert) {
   TTT.startTest();
 });
 
+function escapeClientId(clientId) {
+  return '#' + clientId.replace(/([:\.])/g, '\\$1');
+}
+
 function getSuggestions(id) {
-  return jQueryFrameFn(DomUtils.escapeClientId(
+  return jQueryFrameFn(escapeClientId(
       jQueryFrame(id + " .tobago-suggest").attr("id") + "::popup") + " .tt-suggestion");
 }
diff --git a/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js b/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
index 0e1f24b..51c8055 100644
--- a/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
+++ b/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
@@ -119,8 +119,8 @@ TobagoTestTool.prototype = {
     const done = this.assert.async(getAssertAsync());
     const assert = this.assert;
 
-    function resetTestStepTimeout(ms) {
-      const timeout = ms ? ms : 20000;
+    function resetTestStepTimeout(additionalMs) {
+      const timeout = additionalMs ? 20000 + additionalMs : 20000;
       testStepTimeout = Date.now() + timeout;
     }