You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/09/14 13:31:08 UTC

[myfaces-tobago] 02/06: TOBAGO-1843 Demo: Enhancements for Tobago 5.x

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

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

commit 624c633e391a1f0716dcca97c5649f58bdc201e3
Author: lennox_2019 <le...@web.de>
AuthorDate: Tue Sep 14 15:11:06 2021 +0200

    TOBAGO-1843 Demo: Enhancements for Tobago 5.x
    
    Repair of automatic tests.
---
 .../example/demo/SelectManyCheckboxController.java |   2 +-
 .../50-selectManyCheckbox/Multi_Checkbox.test.js   | 140 ++++++++++-----------
 .../50-selectManyCheckbox/Multi_Checkbox.xhtml     |   6 +-
 .../10-collapsible-popup/Collapsible_Popup.test.js |   3 +-
 .../4810-labelLayoutTop/LabelLayoutTop.test.js     |   3 +-
 .../src/main/webapp/script/tobago-test.js          |   2 +-
 .../resources/tobago/test/tobago-test-tool.js      |   2 +-
 7 files changed, 80 insertions(+), 78 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SelectManyCheckboxController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SelectManyCheckboxController.java
index 067923f..815928d 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SelectManyCheckboxController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SelectManyCheckboxController.java
@@ -82,4 +82,4 @@ public class SelectManyCheckboxController implements Serializable {
   public void setSelectedGiantPlanet(SolarObject[] selectedGiantPlanet) {
     this.selectedGiantPlanet = selectedGiantPlanet;
   }
-}
\ No newline at end of file
+}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.test.js
index 72196f6..d6bc7ed 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.test.js
@@ -19,54 +19,54 @@ import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
 import {querySelectorAllFn, querySelectorFn} from "/script/tobago-test.js";
 
 it("submit: select cat", function (done) {
-    let animalsFn = querySelectorAllFn("#page\\:mainForm\\:animals input");
-    let submitFn = querySelectorFn("#page\\:mainForm\\:submit");
-    let outputFn = querySelectorFn("#page\\:mainForm\\:animalsOutput .form-control-plaintext");
-
-    const test = new JasmineTestTool(done);
-    test.setup(() => outputFn().textContent.trim() === "",
-        () => {
-            animalsFn().item(0).checked = false;
-            animalsFn().item(1).checked = false;
-            animalsFn().item(2).checked = false;
-            animalsFn().item(3).checked = false;
-        },
-        "click", submitFn);
-    test.do(() => animalsFn().item(0).checked = true); // Cat
-    test.do(() => animalsFn().item(1).checked = false);
-    test.do(() => animalsFn().item(2).checked = false);
-    test.do(() => animalsFn().item(3).checked = false);
-    test.event("click", submitFn, () => outputFn().textContent.trim() === "Cat");
-    test.do(() => expect(outputFn().textContent.trim()).toBe("Cat"));
-    test.start();
+  let animalsFn = querySelectorAllFn("#page\\:mainForm\\:animals input");
+  let submitFn = querySelectorFn("#page\\:mainForm\\:submit");
+  let outputFn = querySelectorFn("#page\\:mainForm\\:animalsOutput .form-control-plaintext");
+
+  const test = new JasmineTestTool(done);
+  test.setup(() => outputFn().textContent.trim() === "",
+      () => {
+        animalsFn().item(0).checked = false;
+        animalsFn().item(1).checked = false;
+        animalsFn().item(2).checked = false;
+        animalsFn().item(3).checked = false;
+      },
+      "click", submitFn);
+  test.do(() => animalsFn().item(0).checked = true); // Cat
+  test.do(() => animalsFn().item(1).checked = false);
+  test.do(() => animalsFn().item(2).checked = false);
+  test.do(() => animalsFn().item(3).checked = false);
+  test.event("click", submitFn, () => outputFn().textContent.trim() === "Cat");
+  test.do(() => expect(outputFn().textContent.trim()).toBe("Cat"));
+  test.start();
 });
 
 it("submit: select fox and rabbit", function (done) {
-    let animalsFn = querySelectorAllFn("#page\\:mainForm\\:animals input");
-    let submitFn = querySelectorFn("#page\\:mainForm\\:submit");
-    let outputFn = querySelectorFn("#page\\:mainForm\\:animalsOutput .form-control-plaintext");
-
-    const test = new JasmineTestTool(done);
-    test.setup(() => outputFn().textContent.trim() === "",
-        () => {
-            animalsFn().item(0).checked = false;
-            animalsFn().item(1).checked = false;
-            animalsFn().item(2).checked = false;
-            animalsFn().item(3).checked = false;
-        },
-        "click", submitFn);
-    test.do(() => animalsFn().item(0).checked = false); // Cat
-    test.do(() => animalsFn().item(1).checked = false);
-    test.do(() => animalsFn().item(2).checked = true); // Fox
-    test.do(() => animalsFn().item(3).checked = true); // Rabbit
-    test.event("click", submitFn, () => outputFn().textContent.trim() === "Fox Rabbit");
-    test.do(() => expect(outputFn().textContent.trim()).toBe("Fox Rabbit"));
-    test.start();
+  let animalsFn = querySelectorAllFn("#page\\:mainForm\\:animals input");
+  let submitFn = querySelectorFn("#page\\:mainForm\\:submit");
+  let outputFn = querySelectorFn("#page\\:mainForm\\:animalsOutput .form-control-plaintext");
+
+  const test = new JasmineTestTool(done);
+  test.setup(() => outputFn().textContent.trim() === "",
+      () => {
+        animalsFn().item(0).checked = false;
+        animalsFn().item(1).checked = false;
+        animalsFn().item(2).checked = false;
+        animalsFn().item(3).checked = false;
+      },
+      "click", submitFn);
+  test.do(() => animalsFn().item(0).checked = false); // Cat
+  test.do(() => animalsFn().item(1).checked = false);
+  test.do(() => animalsFn().item(2).checked = true); // Fox
+  test.do(() => animalsFn().item(3).checked = true); // Rabbit
+  test.event("click", submitFn, () => outputFn().textContent.trim() === "Fox Rabbit");
+  test.do(() => expect(outputFn().textContent.trim()).toBe("Fox Rabbit"));
+  test.start();
 });
 
 it("ajax: select 'One'", function (done) {
-    let numberFn = querySelectorFn("#page\\:mainForm\\:numbers\\:\\:0");
-    ajaxSelect(done, numberFn, 1);
+  let numberFn = querySelectorFn("#page\\:mainForm\\:numbers\\:\\:0");
+  ajaxSelect(done, numberFn, 1);
 });
 
 it("ajax: deselect 'One'", function (done) {
@@ -105,35 +105,35 @@ it("ajax: deselect 'Four'", function (done) {
 });
 
 function ajaxSelect(done, numberFn, number) {
-    let outputFn = querySelectorFn("#page\\:mainForm\\:resultOutput .form-control-plaintext");
-    let newOutputValue = parseInt(outputFn().textContent);
-    if (!numberFn().checked) {
-        newOutputValue = parseInt(outputFn().textContent) + number;
-    }
-
-    const test = new JasmineTestTool(done);
-    test.setup(() => parseInt(outputFn().textContent) !== newOutputValue,
-        () => numberFn().checked = false,
-        "change", numberFn);
-    test.do(() => numberFn().checked = true);
-    test.event("change", numberFn, () => parseInt(outputFn().textContent) === newOutputValue);
-    test.do(() => expect(parseInt(outputFn().textContent)).toBe(newOutputValue));
-    test.start();
+  let outputFn = querySelectorFn("#page\\:mainForm\\:resultOutput .form-control-plaintext");
+  let newOutputValue = parseInt(outputFn().textContent);
+  if (!numberFn().checked) {
+    newOutputValue = parseInt(outputFn().textContent) + number;
+  }
+
+  const test = new JasmineTestTool(done);
+  test.setup(() => parseInt(outputFn().textContent) !== newOutputValue,
+      () => numberFn().checked = false,
+      "change", numberFn);
+  test.do(() => numberFn().checked = true);
+  test.event("change", numberFn, () => parseInt(outputFn().textContent) === newOutputValue);
+  test.do(() => expect(parseInt(outputFn().textContent)).toBe(newOutputValue));
+  test.start();
 }
 
 function ajaxDeselect(done, numberFn, number) {
-    let outputFn = querySelectorFn("#page\\:mainForm\\:resultOutput .form-control-plaintext");
-    let newOutputValue = parseInt(outputFn().textContent);
-    if (numberFn().checked) {
-        newOutputValue = parseInt(outputFn().textContent) - number;
-    }
-
-    const test = new JasmineTestTool(done);
-    test.setup(() => parseInt(outputFn().textContent) !== newOutputValue,
-        () => numberFn().checked = true,
-        "change", numberFn);
-    test.do(() => numberFn().checked = false);
-    test.event("change", numberFn, () => parseInt(outputFn().textContent) === newOutputValue);
-    test.do(() => expect(parseInt(outputFn().textContent)).toBe(newOutputValue));
-    test.start();
+  let outputFn = querySelectorFn("#page\\:mainForm\\:resultOutput .form-control-plaintext");
+  let newOutputValue = parseInt(outputFn().textContent);
+  if (numberFn().checked) {
+    newOutputValue = parseInt(outputFn().textContent) - number;
+  }
+
+  const test = new JasmineTestTool(done);
+  test.setup(() => parseInt(outputFn().textContent) !== newOutputValue,
+      () => numberFn().checked = true,
+      "change", numberFn);
+  test.do(() => numberFn().checked = false);
+  test.event("change", numberFn, () => parseInt(outputFn().textContent) === newOutputValue);
+  test.do(() => expect(parseInt(outputFn().textContent)).toBe(newOutputValue));
+  test.start();
 }
\ No newline at end of file
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml
index ab319f7..c05d831 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml
@@ -76,7 +76,7 @@
   <tc:section label="Simple Usage">
     <p>Select an animal. The selection is shown in the output field, after pressing 'Submit'.</p>
     <p><code
-            class="language-markup">&lt;tc:selectManyCheckbox label="Checkbox Group" value="\#{selectManyCheckboxController.animals}"></code>
+        class="language-markup">&lt;tc:selectManyCheckbox label="Checkbox Group" value="\#{selectManyCheckboxController.animals}"></code>
       save the selected value in the controller.
       The available items are added with <code class="language-markup">&lt;tc:selectItem .../></code>.
       The
@@ -121,7 +121,7 @@
       <tc:box>
         First and second giant planets:
         <tc:selectManyCheckbox id="giant0" value="#{selectManyCheckboxController.selectedGiantPlanet}" renderRange="0,1"
-                           labelLayout="skip">
+                               labelLayout="skip">
           <f:selectItems value="#{astroData.giantPlanets}"/>
         </tc:selectManyCheckbox>
       </tc:box>
@@ -184,4 +184,4 @@
 
   </tc:section>
 
-</ui:composition>
\ No newline at end of file
+</ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/Collapsible_Popup.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/Collapsible_Popup.test.js
index 3f7d5cc..dcf6195 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/Collapsible_Popup.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/Collapsible_Popup.test.js
@@ -23,7 +23,7 @@ it("not implemented yet", function (done) {
   test.start();
 });
 
-
+/*
 import {querySelectorAllFn, querySelectorFn} from "/script/tobago-test.js";
 import {TobagoTestTool} from "/tobago/test/tobago-test-tool.js";
 import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
@@ -195,3 +195,4 @@ QUnit.test("Client Side", function (assert) {
   });
   TTT.startTest();
 });
+*/
\ No newline at end of file
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4810-labelLayoutTop/LabelLayoutTop.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4810-labelLayoutTop/LabelLayoutTop.test.js
index 7779da9..27d8099 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4810-labelLayoutTop/LabelLayoutTop.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4810-labelLayoutTop/LabelLayoutTop.test.js
@@ -23,7 +23,7 @@ it("fix tc:file first", function (done) {
   test.start();
 });
 
-
+/*
 import {querySelectorFn} from "/script/tobago-test.js";
 
 QUnit.test("Check width for tc:date", function (assert) {
@@ -98,3 +98,4 @@ function testWidth(assert, idPart) {
   assert.equal(getComputedStyle(compLabelFn()).width, "155px");
   assert.equal(getComputedStyle(compTopFn().querySelector("label")).width, getComputedStyle(compTopFn()).width);
 }
+*/
\ No newline at end of file
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 c991caf..0791fb3 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
@@ -71,4 +71,4 @@ describe("general", function () {
 
     expect(result.indexOf("???")).toBeLessThanOrEqual(-1, "There must no '???' on the site.");
   });
-});
\ No newline at end of file
+});
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 ab340a3..45c47b0 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
@@ -297,4 +297,4 @@ class JasmineTestTool {
   }
 }
 
-export {JasmineUtils, JasmineTestTool};
\ No newline at end of file
+export {JasmineUtils, JasmineTestTool};