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:54 UTC

[myfaces-tobago] 04/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 3dd3ca2cdcc4a31ee6ea879142d94dbf7ea4a12a
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Jul 26 09:27:40 2019 +0200

    TOBAGO-1633: TS refactoring: fix integration tests
    
    * fix some *.test.js
---
 .../content/20-component/010-input/40-date/Date.test.js      |  3 +++
 .../35-deprecated/15-suggest-method/Suggest_Method.test.js   | 12 ++++++++----
 .../40-test/1020-suggest-quotMark/Suggest_QuotMark.test.js   | 10 +++++++---
 .../content/40-test/1041-date-pattern/Date_Pattern.test.js   |  4 ++--
 .../content/40-test/4000-button-link/Button_Link.test.js     |  2 +-
 .../RendererBase_GetCurrentValue.test.js                     |  2 ++
 .../webapp/content/40-test/6500-behavior/Behavior.test.js    |  2 +-
 .../40-test/9010-mode-valueIfSet/Mode_ValueIfSet.test.js     |  8 ++++++--
 8 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/Date.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/Date.test.js
index 17c194d..042300e 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/Date.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/Date.test.js
@@ -15,6 +15,9 @@
  * limitations under the License.
  */
 
+import {jQueryFrameFn} from "/script/tobago-test.js";
+import {TobagoTestTool} from "/tobago/test/tobago-test-tool.js";
+
 function getToday(dateFieldFn) {
   var tobagoToday = dateFieldFn().data("tobago-today");
   var todayArray = tobagoToday.split("-");
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/35-deprecated/15-suggest-method/Suggest_Method.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/35-deprecated/15-suggest-method/Suggest_Method.test.js
index 7063748..08676b0 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/35-deprecated/15-suggest-method/Suggest_Method.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/35-deprecated/15-suggest-method/Suggest_Method.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("Deprecated: 'Ma'", function (assert) {
@@ -32,7 +32,7 @@ QUnit.test("Deprecated: 'Ma'", function (assert) {
   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);
     }
   });
@@ -53,14 +53,18 @@ QUnit.test("Replacement: 'Ma'", function (assert) {
   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);
     }
   });
   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-example/tobago-example-demo/src/main/webapp/content/40-test/1020-suggest-quotMark/Suggest_QuotMark.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1020-suggest-quotMark/Suggest_QuotMark.test.js
index 378e804..428ed24 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1020-suggest-quotMark/Suggest_QuotMark.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1020-suggest-quotMark/Suggest_QuotMark.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,14 +57,18 @@ 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);
     }
   });
   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-example/tobago-example-demo/src/main/webapp/content/40-test/1041-date-pattern/Date_Pattern.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1041-date-pattern/Date_Pattern.test.js
index bce5003..f416979 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1041-date-pattern/Date_Pattern.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1041-date-pattern/Date_Pattern.test.js
@@ -29,7 +29,7 @@ QUnit.test("test patterns", function (assert) {
   */
 });
 
-TestDateTime = {};
+/*TestDateTime = {};
 
 TestDateTime.testDate = function () {
 
@@ -92,4 +92,4 @@ TestDateTime.testBoth = function () {
     console.info("Okay!");
   }
 
-};
+};*/
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button-link/Button_Link.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button-link/Button_Link.test.js
index ebbe44a..102d757 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button-link/Button_Link.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button-link/Button_Link.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("Standard Action Button", function (assert) {
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/RendererBase_GetCurrentValue.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/RendererBase_GetCurrentValue.test.js
index 0513280..a646754 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/RendererBase_GetCurrentValue.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/RendererBase_GetCurrentValue.test.js
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+import {jQueryFrame} from "/script/tobago-test.js";
+
 function test(assert, idSuffix, expectedText) {
   var $out = jQueryFrame("#page\\:mainForm\\:" + idSuffix);
   assert.equal($out.text().trim(), expectedText);
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6500-behavior/Behavior.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6500-behavior/Behavior.test.js
index 92b3643..1be0b1a 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6500-behavior/Behavior.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6500-behavior/Behavior.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("Simple Event", function (assert) {
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.test.js
index 79e3951..a38df3e 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.test.js
@@ -17,13 +17,17 @@
 
 import {jQueryFrame} from "/script/tobago-test.js";
 
+function escapeClientId(clientId) {
+  return '#' + clientId.replace(/([:\.])/g, '\\$1');
+}
+
 QUnit.test("inputfield with label", function (assert) {
 
   assert.expect(6);
 
   function testValueEquals(id) {
 
-    var $field = jQueryFrame(DomUtils.escapeClientId(id));
+    var $field = jQueryFrame(escapeClientId(id));
     var $label = jQueryFrame("[for='" + id + "']");
     assert.equal($field.val(), $label.text());
   }
@@ -42,7 +46,7 @@ QUnit.test("inputfield with label", function (assert) {
 
   function testValueEquals(id) {
 
-    var $field = jQueryFrame(DomUtils.escapeClientId(id));
+    var $field = jQueryFrame(escapeClientId(id));
     var $label = jQueryFrame("[for='" + id + "']");
     assert.equal($field.attr("id"), $label.text());
   }