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/31 13:20:04 UTC

[myfaces-tobago] 02/02: TOBAGO-1633: TS refactoring: fix 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 620af8afe22c24e2db61d23b7d4890f9bcda68cf
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Jul 31 15:04:15 2019 +0200

    TOBAGO-1633: TS refactoring: fix tests
    
    * sheet event test fixed
    * event test fixed
---
 .../080-sheet/30-event/Sheet_Event.test.js         | 25 +++++++++++-----------
 .../content/40-test/6000-event/Event.test.js       |  2 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/Sheet_Event.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/Sheet_Event.test.js
index 671f893..6615f80 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/Sheet_Event.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/Sheet_Event.test.js
@@ -15,22 +15,20 @@
  * limitations under the License.
  */
 
-import {jQueryFrameFn} from "/script/tobago-test.js";
+import {jQueryFrameFn, testFrameQuerySelectorFn} from "/script/tobago-test.js";
 import {TobagoTestTool} from "/tobago/test/tobago-test-tool.js";
 
 QUnit.test("On click with ajax", function (assert) {
-  var oneClickAjaxFn = jQueryFrameFn("#page\\:mainForm\\:changeExample\\:\\:0");
+  var oneClickAjaxFn = testFrameQuerySelectorFn("#page\\:mainForm\\:changeExample\\:\\:0");
   var venusFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:2\\:sample0");
   var jupiterFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:5\\:sample0");
   var saturnFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:6\\:sample0");
   var namefieldFn = jQueryFrameFn("#page\\:mainForm\\:name\\:\\:field");
 
-  // ensure: the radio button is not checked
-  oneClickAjaxFn().prop("checked", false);
-
   var TTT = new TobagoTestTool(assert);
   TTT.action(function () {
-    oneClickAjaxFn().click();
+    oneClickAjaxFn().checked = true;
+    oneClickAjaxFn().dispatchEvent(new Event('change'));
   });
   TTT.waitForResponse();
   TTT.asserts(3, function () {
@@ -63,7 +61,7 @@ QUnit.test("On click with ajax", function (assert) {
 });
 
 QUnit.test("On click with full request", function (assert) {
-  var oneClickFullRequestFn = jQueryFrameFn("#page\\:mainForm\\:changeExample\\:\\:1");
+  var oneClickFullRequestFn = testFrameQuerySelectorFn("#page\\:mainForm\\:changeExample\\:\\:1");
   var venusFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:2\\:sample1");
   var jupiterFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:5\\:sample1");
   var saturnFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:6\\:sample1");
@@ -71,7 +69,8 @@ QUnit.test("On click with full request", function (assert) {
 
   var TTT = new TobagoTestTool(assert);
   TTT.action(function () {
-    oneClickFullRequestFn().click();
+    oneClickFullRequestFn().checked = true;
+    oneClickFullRequestFn().dispatchEvent(new Event('change'));
   });
   TTT.waitForResponse();
   TTT.asserts(3, function () {
@@ -104,7 +103,7 @@ QUnit.test("On click with full request", function (assert) {
 });
 
 QUnit.test("On double click with full request", function (assert) {
-  var doubleClickFullRequestFn = jQueryFrameFn("#page\\:mainForm\\:changeExample\\:\\:2");
+  var doubleClickFullRequestFn = testFrameQuerySelectorFn("#page\\:mainForm\\:changeExample\\:\\:2");
   var venusFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:2\\:sample2");
   var jupiterFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:5\\:sample2");
   var saturnFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:6\\:sample2");
@@ -112,7 +111,8 @@ QUnit.test("On double click with full request", function (assert) {
 
   var TTT = new TobagoTestTool(assert);
   TTT.action(function () {
-    doubleClickFullRequestFn().click();
+    doubleClickFullRequestFn().checked = true;
+    doubleClickFullRequestFn().dispatchEvent(new Event('change'));
   });
   TTT.waitForResponse();
   TTT.asserts(3, function () {
@@ -145,7 +145,7 @@ QUnit.test("On double click with full request", function (assert) {
 });
 
 QUnit.test("Open popup on click with ajax", function (assert) {
-  var radioButtonFn = jQueryFrameFn("#page\\:mainForm\\:changeExample\\:\\:3");
+  var radioButtonFn = testFrameQuerySelectorFn("#page\\:mainForm\\:changeExample\\:\\:3");
   var venusFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:2\\:sample3");
   var jupiterFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:5\\:sample3");
   var saturnFn = jQueryFrameFn("#page\\:mainForm\\:s1\\:6\\:sample3");
@@ -155,7 +155,8 @@ QUnit.test("Open popup on click with ajax", function (assert) {
 
   var TTT = new TobagoTestTool(assert);
   TTT.action(function () {
-    radioButtonFn().click();
+    radioButtonFn().checked = true;
+    radioButtonFn().dispatchEvent(new Event('change'));
   });
   TTT.waitForResponse();
   TTT.asserts(3, function () {
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/Event.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/Event.test.js
index 6f82e4d..f282b16 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/Event.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/Event.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("tc:button", function (assert) {