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 2026/05/26 13:14:03 UTC

(myfaces-tobago) 01/02: refactor: replace faces.ajax.request() with tobago.ajax.request()

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

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

commit f877f9e19abe165befb06a92ec7ad6bb741c12e7
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Apr 27 17:52:16 2026 +0200

    refactor: replace faces.ajax.request() with tobago.ajax.request()
    
    Replace "faces.ajax.request()" with "tobago.ajax.request()" to use the Tobago Ajax queue.
    
    Adjust selectOne/ManyList server side filtering tests
    
    Issue: TOBAGO-2521
---
 .../server-side-filtering/Server_side_filtering.test.ts      | 12 ++++++------
 .../server-side-filtering/Server_side_filtering.test.ts      | 12 ++++++------
 .../tobago-theme-standard/src/main/ts/tobago-behavior.ts     |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-paginator.ts    |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-reload.ts       |  2 +-
 .../src/main/ts/tobago-select-list-base.ts                   |  2 +-
 .../src/main/ts/tobago-select-many-list.ts                   |  4 ++--
 .../src/main/ts/tobago-select-one-list.ts                    |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-sheet.ts        |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-suggest.ts      |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-toasts.ts       |  4 ++--
 .../tobago-theme-standard/src/main/ts/tobago-tree-node.ts    |  2 +-
 12 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectManyList/server-side-filtering/Server_side_filtering.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectManyList/server-side-filtering/Server_side_filtering.test.ts
index 7b8df2e61f..e88edd1ce5 100644
--- a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectManyList/server-side-filtering/Server_side_filtering.test.ts
+++ b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectManyList/server-side-filtering/Server_side_filtering.test.ts
@@ -106,19 +106,19 @@ test.describe("900-test/selectManyList/server-side-filtering/Server_side_filteri
     await expect(blurCounter).toHaveText("0");
     await selectField.dblclick();
     await expect(changeCounter).toHaveText("0");
-    await expect(clickCounter).toHaveText("3");
+    await expect(clickCounter).toHaveText("2"); //increase by one instead of two, because Ajax queue blocks a second identical click event request
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("1");
     await expect(blurCounter).toHaveText("0");
     await reset.focus();
     await expect(changeCounter).toHaveText("0");
-    await expect(clickCounter).toHaveText("3");
+    await expect(clickCounter).toHaveText("2");
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("1");
     await expect(blurCounter).toHaveText("1");
     await filterInput.click();
     await expect(changeCounter).toHaveText("0");
-    await expect(clickCounter).toHaveText("4");
+    await expect(clickCounter).toHaveText("3");
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("1");
@@ -128,19 +128,19 @@ test.describe("900-test/selectManyList/server-side-filtering/Server_side_filteri
     await expect(output).toHaveText("Thebe;");
     await expect(badges).not.toHaveCount(0);
     await expect(changeCounter).toHaveText("1");
-    await expect(clickCounter).toHaveText("5");
+    await expect(clickCounter).toHaveText("4");
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("1");
     await selectField.dblclick();
     await expect(changeCounter).toHaveText("1");
-    await expect(clickCounter).toHaveText("7");
+    await expect(clickCounter).toHaveText("5");  //increase by one instead of two, because Ajax queue blocks a second identical click event request
     await expect(dblclickCounter).toHaveText("2");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("1");
     await reset.focus();
     await expect(changeCounter).toHaveText("1");
-    await expect(clickCounter).toHaveText("7");
+    await expect(clickCounter).toHaveText("5");
     await expect(dblclickCounter).toHaveText("2");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("2");
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectOneList/server-side-filtering/Server_side_filtering.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectOneList/server-side-filtering/Server_side_filtering.test.ts
index 3b2f7b4fb4..fdf21480b3 100644
--- a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectOneList/server-side-filtering/Server_side_filtering.test.ts
+++ b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/selectOneList/server-side-filtering/Server_side_filtering.test.ts
@@ -125,19 +125,19 @@ test.describe("900-test/selectOneList/server-side-filtering/Server_side_filterin
     await expect(blurCounter).toHaveText("0");
     await selectField.dblclick();
     await expect(changeCounter).toHaveText("0");
-    await expect(clickCounter).toHaveText("3");
+    await expect(clickCounter).toHaveText("2"); //increase by one instead of two, because Ajax queue blocks a second identical click event request
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("1");
     await expect(blurCounter).toHaveText("0");
     await reset.focus();
     await expect(changeCounter).toHaveText("0");
-    await expect(clickCounter).toHaveText("3");
+    await expect(clickCounter).toHaveText("2");
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("1");
     await expect(blurCounter).toHaveText("1");
     await filterInput.click();
     await expect(changeCounter).toHaveText("0");
-    await expect(clickCounter).toHaveText("4");
+    await expect(clickCounter).toHaveText("3");
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("1");
@@ -146,19 +146,19 @@ test.describe("900-test/selectOneList/server-side-filtering/Server_side_filterin
     await venusSelectItem.click();
     await expect(span).toHaveText("Venus");
     await expect(changeCounter).toHaveText("1");
-    await expect(clickCounter).toHaveText("5");
+    await expect(clickCounter).toHaveText("4");
     await expect(dblclickCounter).toHaveText("1");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("1");
     await selectField.dblclick();
     await expect(changeCounter).toHaveText("1");
-    await expect(clickCounter).toHaveText("7");
+    await expect(clickCounter).toHaveText("5"); //increase by one instead of two, because Ajax queue blocks a second identical click event request
     await expect(dblclickCounter).toHaveText("2");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("1");
     await reset.focus();
     await expect(changeCounter).toHaveText("1");
-    await expect(clickCounter).toHaveText("7");
+    await expect(clickCounter).toHaveText("5");
     await expect(dblclickCounter).toHaveText("2");
     await expect(focusCounter).toHaveText("2");
     await expect(blurCounter).toHaveText("2");
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
index 1ebc568345..4c55a2f93d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
@@ -121,7 +121,7 @@ class Behavior extends HTMLElement {
             }
           }
         }
-        faces.ajax.request(
+        tobago.ajax.request(
             this.actionElement,
             event,
             {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-paginator.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-paginator.ts
index 9e346e0878..445a381037 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-paginator.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-paginator.ts
@@ -97,7 +97,7 @@ export class TobagoPaginator extends HTMLElement {
     sheet.insertAdjacentHTML("beforeend",
         Overlay.htmlText(sheet.id, OverlayType.ajax, Page.page(this).waitOverlayDelayAjax));
 
-    faces.ajax.request(
+    tobago.ajax.request(
         this.id,
         null,
         {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-reload.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-reload.ts
index 880635e7f7..24a28d5675 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-reload.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-reload.ts
@@ -44,7 +44,7 @@ class TobagoReload extends HTMLElement {
       // add new schedule
       const timeout = window.setTimeout(function (): void {
         console.debug("reloading #'%s'", componentId);
-        faces.ajax.request(
+        tobago.ajax.request(
             reloadId,
             null,
             {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
index b11bcf0f9c..62147a8973 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
@@ -170,7 +170,7 @@ export abstract class SelectListBase extends HTMLElement {
   protected doFilter(searchString: string) {
     if (this.serverSideFiltering) {
       this.hiddenQueryInput.value = searchString;
-      faces.ajax.request(
+      tobago.ajax.request(
           this.id,
           null,
           {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts
index 39ab50b267..a37cfe864c 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts
@@ -82,7 +82,7 @@ class SelectManyList extends SelectListBase {
     option.selected = !option.selected;
 
     if (this.serverSideFiltering) {
-      faces.ajax.request(
+      tobago.ajax.request(
           this.id,
           null,
           {
@@ -169,7 +169,7 @@ class SelectManyList extends SelectListBase {
     }
 
     if (this.serverSideFiltering) {
-      faces.ajax.request(
+      tobago.ajax.request(
           this.id,
           null,
           {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-one-list.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-one-list.ts
index fe6e45c310..641c955b24 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-one-list.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-one-list.ts
@@ -85,7 +85,7 @@ class SelectOneList extends SelectListBase {
     this.filterInput.value = null;
 
     if (this.serverSideFiltering) {
-      faces.ajax.request(
+      tobago.ajax.request(
           this.id,
           null,
           {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
index 562fda3b9f..c40a57ff18 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
@@ -207,7 +207,7 @@ export class Sheet extends HTMLElement {
       input.value = String(next.from + 1); //input.value rowIndex starts at 1 (not 0)
       console.debug(`reload sheet with action '${input.id}'`); // @DEV_ONLY
 
-      faces.ajax.request(
+      tobago.ajax.request(
           input.id,
           null,
           {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
index e1f4bbb6f5..7ca9bbabe4 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
@@ -220,7 +220,7 @@ export class Suggest {
       if (this.update) {
         this.timeout = window.setTimeout(() => {
           const suggestId = this.tobagoSuggest.id;
-          faces.ajax.request(suggestId, null, {
+          tobago.ajax.request(suggestId, null, {
             params: {
               "jakarta.faces.behavior.event": "suggest"
             },
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-toasts.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-toasts.ts
index 71089902ed..3168ab89c4 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-toasts.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-toasts.ts
@@ -137,7 +137,7 @@ class Toasts extends HTMLElement {
       const states = this.states;
       states.get(id).state = StateEnum.showed;
       this.states = states;
-      faces.ajax.request(this.id, null, {
+      tobago.ajax.request(this.id, null, {
         params: {
           "jakarta.faces.behavior.event": "toastShown"
         },
@@ -153,7 +153,7 @@ class Toasts extends HTMLElement {
       const states = this.states;
       states.get(id).state = StateEnum.closed;
       this.states = states;
-      faces.ajax.request(this.id, null, {
+      tobago.ajax.request(this.id, null, {
         params: {
           "jakarta.faces.behavior.event": "toastHide"
         },
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-tree-node.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-tree-node.ts
index b1447f3ca9..dbb90bfa7d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-tree-node.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-tree-node.ts
@@ -86,7 +86,7 @@ export class TreeNode extends HTMLElement {
   }
 
   private ajax(event: Event, parentId: string, render: boolean): void {
-    faces.ajax.request(
+    tobago.ajax.request(
         this.id,
         event,
         {