You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2025/02/17 08:59:38 UTC
(myfaces-tobago) 02/04: test: dropdown with ui:repeat
This is an automated email from the ASF dual-hosted git repository.
bommel pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 32232885d8b1fd8400fbe91b47e2f85059e32ac8
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Feb 13 11:42:43 2025 +0100
test: dropdown with ui:repeat
Issue: TOBAGO-2385
(cherry picked from commit 20a0f9b2e7d825dc7719f71d5168d223e1d7a88c)
---
.../main/webapp/content/900-test/2300-link/Link.test.js | 14 +++++++++++++-
.../src/main/webapp/content/900-test/2300-link/Link.xhtml | 10 ++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.test.js
index 8d7346c699..fd801b27f2 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.test.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import {querySelectorFn} from "/script/tobago-test.js";
+import {elementByIdFn, querySelectorFn} from "/script/tobago-test.js";
import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
it("compare a.link and button.link", function (done) {
@@ -26,3 +26,15 @@ it("compare a.link and button.link", function (done) {
test.do(() => expect(aLinkText().offsetLeft).toBe(buttonLinkText().offsetLeft));
test.start();
});
+
+it("Dropdown menu must have three entries", function (done) {
+ const dropdown = elementByIdFn("page:mainForm:dropdownRepeat");
+
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(dropdown()).not.toBeNull());
+ test.do(() => expect(dropdown().querySelectorAll(".dropdown-item").length).toBe(3));
+ test.do(() => expect(dropdown().querySelectorAll(".dropdown-item")[0].textContent).toBe("Nile"));
+ test.do(() => expect(dropdown().querySelectorAll(".dropdown-item")[1].textContent).toBe("Amazon"));
+ test.do(() => expect(dropdown().querySelectorAll(".dropdown-item")[2].textContent).toBe("Yangtze"));
+ test.start();
+});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.xhtml
index 1dcc61b0f2..83a34f7f37 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.xhtml
@@ -19,8 +19,7 @@
<ui:composition template="/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:f="http://xmlns.jcp.org/jsf/core">
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<tc:link id="aLink" label="a.link" link="https://www.apache.org/">
<tc:style width="200px"/>
</tc:link>
@@ -28,4 +27,11 @@
<tc:link id="buttonLink" label="button.link">
<tc:style width="200px"/>
</tc:link>
+
+ <tc:link id="dropdownRepeat" label="Dropdown with ui:repeat" omit="true">
+ <tc:style customClass="icon-button"/>
+ <ui:repeat var="river" value="#{forEachController.rivers}">
+ <tc:link id="#{river.name}" label="#{river.name}" omit="true"/>
+ </ui:repeat>
+ </tc:link>
</ui:composition>