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 2025/10/02 07:43:02 UTC

(myfaces-tobago) branch main updated: test(tabGroup): immediate with tc:file

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 881b764ab7 test(tabGroup): immediate with tc:file
881b764ab7 is described below

commit 881b764ab73e8c39d494448c99ba944085b00dc1
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Oct 2 09:34:21 2025 +0200

    test(tabGroup): immediate with tc:file
---
 .../2510-tab-file/TabGroup_Immediate_File.xhtml    | 11 +++----
 .../src/test/typescript/tab-group.test.ts          | 36 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2510-tab-file/TabGroup_Immediate_File.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2510-tab-file/TabGroup_Immediate_File.xhtml
index 18554d3665..f889ffe53a 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2510-tab-file/TabGroup_Immediate_File.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2510-tab-file/TabGroup_Immediate_File.xhtml
@@ -20,18 +20,17 @@
 <ui:composition template="/main.xhtml"
                 xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
-                xmlns:ui="jakarta.faces.facelets"
-                xmlns:f="jakarta.faces.core">
+                xmlns:ui="jakarta.faces.facelets">
 
-  <tc:tabGroup switchType="reloadTab" immediate="true">
+  <tc:tabGroup id="tabgroup" switchType="reloadTab" immediate="true">
     <tc:tab id="nt1" label="One">
-      <tc:file required="true"/>
+      <tc:file id="file" required="true"/>
     </tc:tab>
     <tc:tab id="nt2" label="Two">
-      Two
+      <tc:out id="output" value="Two"/>
     </tc:tab>
   </tc:tabGroup>
 
-  <tc:button action="ok" label="ok"/>
+  <tc:button id="ok" action="ok" label="ok"/>
 
 </ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/tab-group.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/tab-group.test.ts
index b52a0aa296..8971de381f 100644
--- a/tobago-example/tobago-example-demo/src/test/typescript/tab-group.test.ts
+++ b/tobago-example/tobago-example-demo/src/test/typescript/tab-group.test.ts
@@ -202,3 +202,39 @@ test.describe("900-test/2500-tab/Tabgroup_Style.xhtml", () => {
     await expect(barFacet).toHaveCSS("border-bottom-color", Color.transparent);
   }
 });
+
+test.describe("900-test/2510-tab-file/TabGroup_Immediate_File.xhtml", () => {
+
+  test.beforeEach(async ({page}) => {
+    await page.goto("http://localhost:8080/content/900-test/2510-tab-file/TabGroup_Immediate_File.xhtml");
+  });
+
+  test("Select tab 'Two', press OK, select tab 'One', press OK", async ({page}) => {
+    const tabGroupIndex = page.locator("input[id='page:mainForm:tabgroup::index']");
+    const tab1 = page.locator("tobago-tab[id='page:mainForm:nt1'] .nav-link");
+    const tab2 = page.locator("tobago-tab[id='page:mainForm:nt2'] .nav-link");
+    const file = page.locator("tobago-file[id='page:mainForm:nt1:file']");
+    const output = page.locator("tobago-out[id='page:mainForm:nt2:output']");
+    const messagesWarning = page.locator("tobago-messages[id='page:messages'] .alert-warning");
+    const messagesError = page.locator("tobago-messages[id='page:messages'] .alert-danger");
+    const okButton = page.locator("button[id='page:mainForm:ok']");
+
+    await tab2.click();
+    await expect(tabGroupIndex).toHaveValue("1");
+    await expect(file).not.toBeVisible();
+    await expect(output).toBeVisible();
+
+    await okButton.click();
+    await expect(tabGroupIndex).toHaveValue("1");
+    await expect(messagesWarning).toBeVisible();
+
+    await tab1.click();
+    await expect(tabGroupIndex).toHaveValue("0");
+    await expect(file).toBeVisible();
+    await expect(output).not.toBeVisible();
+
+    await okButton.click();
+    await expect(tabGroupIndex).toHaveValue("0");
+    await expect(messagesError).toBeVisible();
+  });
+});