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 2023/04/21 12:29:44 UTC

[myfaces-tobago] branch tobago-5.x updated (82a299985c -> 623403bbb7)

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

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


    from 82a299985c fix: showPageRange vs. showRowRange (#3975)
     new 91f2f4d9de fix(selectOneList): show itemLabel for selected Value issue: TOBAGO-2212
     new 42c3575278 fix(selectOneList): show itemLabel for selected Value issue: TOBAGO-2212
     new 623403bbb7 fix(test): selectOneList

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../030-select/45-selectOneList/SelectOneList.test.js  | 18 +++++++++---------
 .../tobago-theme-standard/src/main/js/tobago.js        |  2 +-
 .../tobago-theme-standard/src/main/js/tobago.js.map    |  2 +-
 .../src/main/ts/tobago-select-one-list.ts              | 11 ++++++++---
 4 files changed, 19 insertions(+), 14 deletions(-)


[myfaces-tobago] 02/03: fix(selectOneList): show itemLabel for selected Value issue: TOBAGO-2212

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 42c3575278d51a76c6d93c1b97844707e106419d
Author: Bernd Bohmann <bo...@apache.org>
AuthorDate: Fri Apr 21 10:58:15 2023 +0200

    fix(selectOneList): show itemLabel for selected Value
    issue: TOBAGO-2212
    
    (cherry picked from commit 851316bfa1dbfba87ba99d77a607079cd597c4d4)
---
 .../030-select/45-selectOneList/SelectOneList.test.js  | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js
index b19fa4d2d5..4af9d9dbdd 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js
@@ -27,20 +27,20 @@ it("Standard: select 'Mars', select 'Saturn'", function (done) {
   const submitFn = elementByIdFn("page:mainForm:basic:submit");
 
   const test = new JasmineTestTool(done);
-  test.setup(() => selectedFieldFn().textContent === "Neptune", neptuneRowFn().click(), "click", submitFn);
+  test.setup(() => selectedFieldFn().textContent.trim() === "Neptune", neptuneRowFn().click(), "click", submitFn);
 
-  test.do(() => expect(selectedFieldFn().textContent).toEqual("Neptune"));
-  test.do(() => expect(disabledSelectedFieldFn().textContent).toEqual("Neptune"));
+  test.do(() => expect(selectedFieldFn().textContent.trim()).toEqual("Neptune"));
+  test.do(() => expect(disabledSelectedFieldFn().textContent.trim()).toEqual("Neptune"));
 
   test.do(() => marsRowFn().click());
-  test.event("click", submitFn, () => disabledSelectedFieldFn().textContent === "Mars");
-  test.do(() => expect(selectedFieldFn().textContent).toEqual("Mars"));
-  test.do(() => expect(disabledSelectedFieldFn().textContent).toEqual("Mars"));
+  test.event("click", submitFn, () => disabledSelectedFieldFn().textContent.trim() === "Mars");
+  test.do(() => expect(selectedFieldFn().textContent.trim()).toEqual("Mars"));
+  test.do(() => expect(disabledSelectedFieldFn().textContent.trim()).toEqual("Mars"));
 
   test.do(() => saturnRowFn().click());
-  test.event("click", submitFn, () => disabledSelectedFieldFn().textContent === "Saturn");
-  test.do(() => expect(selectedFieldFn().textContent).toEqual("Saturn"));
-  test.do(() => expect(disabledSelectedFieldFn().textContent).toEqual("Saturn"));
+  test.event("click", submitFn, () => disabledSelectedFieldFn().textContent.trim() === "Saturn");
+  test.do(() => expect(selectedFieldFn().textContent.trim()).toEqual("Saturn"));
+  test.do(() => expect(disabledSelectedFieldFn().textContent.trim()).toEqual("Saturn"));
 
   test.start();
 });


[myfaces-tobago] 03/03: fix(test): selectOneList

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 623403bbb7f5629894430aeefa2acfae78239102
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Apr 21 14:03:38 2023 +0200

    fix(test): selectOneList
    
    (cherry picked from commit 673f7cb42a62b4918cbc8ae389b7c4b59ab05979)
---
 .../webapp/content/030-select/45-selectOneList/SelectOneList.test.js    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js
index 4af9d9dbdd..cf2f297084 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/030-select/45-selectOneList/SelectOneList.test.js
@@ -27,7 +27,7 @@ it("Standard: select 'Mars', select 'Saturn'", function (done) {
   const submitFn = elementByIdFn("page:mainForm:basic:submit");
 
   const test = new JasmineTestTool(done);
-  test.setup(() => selectedFieldFn().textContent.trim() === "Neptune", neptuneRowFn().click(), "click", submitFn);
+  test.setup(() => disabledSelectedFieldFn().textContent.trim() === "Neptune", () => neptuneRowFn().click(), "click", submitFn);
 
   test.do(() => expect(selectedFieldFn().textContent.trim()).toEqual("Neptune"));
   test.do(() => expect(disabledSelectedFieldFn().textContent.trim()).toEqual("Neptune"));


[myfaces-tobago] 01/03: fix(selectOneList): show itemLabel for selected Value issue: TOBAGO-2212

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 91f2f4d9de32092468f5edfce4bd888bef7e3149
Author: Bernd Bohmann <bo...@apache.org>
AuthorDate: Thu Apr 20 21:23:09 2023 +0200

    fix(selectOneList): show itemLabel for selected Value
    issue: TOBAGO-2212
    
    (cherry picked from commit 5b0a1cb6f434296416ef6f5a49660cfe31ae2d47)
---
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js      |  2 +-
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map  |  2 +-
 .../src/main/ts/tobago-select-one-list.ts                     | 11 ++++++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index 33f842204a..2556a4db38 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -15,5 +15,5 @@ const Be="transitionend",Me=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#
       ${s>0?" tabindex='"+String(s)+"'":""}
       @click="${this.removeBadge.bind(this)}"
       @focus="${this.focusEvent.bind(this)}"
-      @blur="${this.blurEvent.bind(this)}"><i class='bi-x-lg'></i></button>`}removeBadge(e){const t=e.target.closest(".btn-group").dataset.tobagoValue,s=this.hiddenSelect.querySelector(`[value="${t}"]`);s.selected=!1;const i=this.selectField.querySelector(`[data-tobago-value="${t}"]`),n=i.previousElementSibling,o="SPAN"===i.nextElementSibling.tagName?i.nextElementSibling:null;n?n.querySelector("button.btn.badge").focus():o?o.querySelector("button.btn.badge").focus():(this.filterInput.dis [...]
+      @blur="${this.blurEvent.bind(this)}"><i class='bi-x-lg'></i></button>`}removeBadge(e){const t=e.target.closest(".btn-group").dataset.tobagoValue,s=this.hiddenSelect.querySelector(`[value="${t}"]`);s.selected=!1;const i=this.selectField.querySelector(`[data-tobago-value="${t}"]`),n=i.previousElementSibling,o="SPAN"===i.nextElementSibling.tagName?i.nextElementSibling:null;n?n.querySelector("button.btn.badge").focus():o?o.querySelector("button.btn.badge").focus():(this.filterInput.dis [...]
 //# sourceMappingURL=tobago.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 63d209efad..c8da72bd7d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.j [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.j [...]
\ No newline at end of file
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 29302f8765..1302d5aca7 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
@@ -32,6 +32,11 @@ class SelectOneList extends SelectListBase {
     this.selectField.querySelector("span").textContent = text;
   }
 
+  get selectedOption() :HTMLOptionElement {
+    const value = this.hiddenSelect.value;
+    return this.hiddenSelect.querySelector(`[value="${value}"]`);
+  }
+
   connectedCallback(): void {
     super.connectedCallback();
     this.selectField.addEventListener("keydown", this.keydownEvent.bind(this));
@@ -58,7 +63,7 @@ class SelectOneList extends SelectListBase {
   private keydownEvent(event: KeyboardEvent) {
     switch (event.key) {
       case Key.ESCAPE:
-        this.spanText = this.hiddenSelect.value;
+        this.spanText = this.selectedOption.textContent;
         break;
       case Key.BACKSPACE:
         if (this.filterInput.value.length === 0) {
@@ -83,7 +88,7 @@ class SelectOneList extends SelectListBase {
   private sync() {
     this.rows.forEach((row) => {
       if (row.dataset.tobagoValue === this.hiddenSelect.value) {
-        this.spanText = this.hiddenSelect.value;
+        this.spanText = this.selectedOption.textContent;
         row.classList.add(Css.TABLE_PRIMARY); // highlight list row
       } else {
         row.classList.remove(Css.TABLE_PRIMARY); // remove highlight list row
@@ -95,7 +100,7 @@ class SelectOneList extends SelectListBase {
     this.focused = false;
     this.filterInput.value = null;
     this.filterInput.dispatchEvent(new Event("input"));
-    this.spanText = this.hiddenSelect.value;
+    this.spanText = this.selectedOption.textContent;
     this.hideDropdown();
   }
 }