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 2024/05/22 10:39:05 UTC

(myfaces-tobago) branch tobago-5.x updated (ee3529b886 -> b0c995cbdf)

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 ee3529b886 docs: improve release checklist
     new 48c0597749 fix(select[One/Many]List): duplicated dropdown menus
     new b0c995cbdf build(theme): rebuild after fixing selectOneList/selectManyList

The 2 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:
 .../2098-selectOneList/SelectOneList.test.js       | 54 ++++++++++++++++++++++
 .../SelectOneList.xhtml}                           | 25 ++++------
 .../tobago-theme-standard/src/main/js/tobago.js    |  2 +-
 .../src/main/js/tobago.js.map                      |  2 +-
 .../src/main/ts/tobago-select-list-base.ts         |  4 ++
 5 files changed, 68 insertions(+), 19 deletions(-)
 create mode 100644 tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.test.js
 copy tobago-example/tobago-example-demo/src/main/webapp/content/900-test/{4100-footer/FixedFooter_height.xhtml => 2098-selectOneList/SelectOneList.xhtml} (66%)


(myfaces-tobago) 02/02: build(theme): rebuild after fixing selectOneList/selectManyList

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 b0c995cbdfab3dd70e31abeae620d168bd6bc960
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed May 22 12:00:26 2024 +0200

    build(theme): rebuild after fixing selectOneList/selectManyList
---
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js     | 2 +-
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map | 2 +-
 2 files changed, 2 insertions(+), 2 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 460c89f4ef..ac91ee7ad8 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -4,7 +4,7 @@
       * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
       * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
       */
-const Me=new Map,Be={set(e,t,s){Me.has(e)||Me.set(e,new Map);const n=Me.get(e);n.has(t)||0===n.size?n.set(t,s):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(e,t)=>Me.has(e)&&Me.get(e).get(t)||null,remove(e,t){if(!Me.has(e))return;const s=Me.get(e);s.delete(t),0===s.size&&Me.delete(e)}},Pe="transitionend",He=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),j [...]
+const Me=new Map,Be={set(e,t,s){Me.has(e)||Me.set(e,new Map);const n=Me.get(e);n.has(t)||0===n.size?n.set(t,s):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(e,t)=>Me.has(e)&&Me.get(e).get(t)||null,remove(e,t){if(!Me.has(e))return;const s=Me.get(e);s.delete(t),0===s.size&&Me.delete(e)}},Pe="transitionend",He=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),j [...]
 /**
      * @license
      * Copyright 2017 Google LLC
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 ff39b488b8..f82c890e86 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-collapse-operation.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/@poppe [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../ts/tobago-collapse-operation.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/@poppe [...]
\ No newline at end of file


(myfaces-tobago) 01/02: fix(select[One/Many]List): duplicated dropdown menus

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 48c0597749e4f79f2544222299e2575aa7f47575
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue May 21 13:56:16 2024 +0200

    fix(select[One/Many]List): duplicated dropdown menus
    
    * add test
    * implement disconnectedCallback: remove dropdown menu
    
    Issue: TOBAGO-2314
---
 .../2098-selectOneList/SelectOneList.test.js       | 54 ++++++++++++++++++++++
 .../2098-selectOneList/SelectOneList.xhtml         | 32 +++++++++++++
 .../src/main/ts/tobago-select-list-base.ts         |  4 ++
 3 files changed, 90 insertions(+)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.test.js
new file mode 100644
index 0000000000..b71f7c84be
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.test.js
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
+import {elementByIdFn, querySelectorAllFn, querySelectorFn} from "/script/tobago-test.js";
+
+it("Standard: select 'Venus', select 'Earth'", function (done) {
+  const selectFieldFn = elementByIdFn("page:mainForm:selectedStandard::selectField");
+  const optionsFn = querySelectorAllFn(".tobago-options[name='page:mainForm:selectedStandard']");
+  const mercuryRowFn = querySelectorFn(".tobago-options[name='page:mainForm:selectedStandard'] tr[data-tobago-value='Mercury']");
+  const venusRowFn = querySelectorFn(".tobago-options[name='page:mainForm:selectedStandard'] tr[data-tobago-value='Venus']");
+  const earthRowFn = querySelectorFn(".tobago-options[name='page:mainForm:selectedStandard'] tr[data-tobago-value='Earth']");
+  const outputFn = querySelectorFn("#page\\:mainForm\\:output .form-control-plaintext");
+
+  const test = new JasmineTestTool(done);
+  test.setup(() => outputFn().textContent === "Mercury", null, "click", mercuryRowFn);
+
+  test.do(() => expect(optionsFn().length).toEqual(1));
+  test.do(() => expect(optionsFn()[0].classList).not.toContain("show"));
+
+  test.event("click", selectFieldFn, () => optionsFn()[0].classList.contains("show"));
+  test.do(() => expect(optionsFn().length).toEqual(1));
+  test.do(() => expect(optionsFn()[0].classList).toContain("show"));
+
+  test.event("click", venusRowFn, () => outputFn().textContent === "Venus");
+  test.do(() => expect(optionsFn().length).toEqual(1));
+  test.do(() => expect(optionsFn()[0].classList).not.toContain("show"));
+  test.do(() => expect(outputFn().textContent).toEqual("Venus"));
+
+  test.event("click", selectFieldFn, () => optionsFn()[0].classList.contains("show"));
+  test.do(() => expect(optionsFn().length).toEqual(1));
+  test.do(() => expect(optionsFn()[0].classList).toContain("show"));
+
+  test.event("click", earthRowFn, () => outputFn().textContent === "Earth");
+  test.do(() => expect(optionsFn().length).toEqual(1));
+  test.do(() => expect(optionsFn()[0].classList).not.toContain("show"));
+  test.do(() => expect(outputFn().textContent).toEqual("Earth"));
+
+  test.start();
+});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.xhtml
new file mode 100644
index 0000000000..1abe7be3b8
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2098-selectOneList/SelectOneList.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="jakarta.faces.core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="jakarta.faces.facelets">
+
+  <tc:selectOneList id="selectedStandard" label="Standard" value="#{selectOneListController.selectedPlanet}">
+    <tc:selectItems value="#{selectOneListController.planets}"
+                    var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"/>
+    <f:ajax render="selectedStandard output"/>
+  </tc:selectOneList>
+  <tc:out id="output" label="Planet" value="#{selectOneListController.selectedPlanet}"/>
+</ui:composition>
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 9727b5a823..8042f7143d 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
@@ -122,6 +122,10 @@ export abstract class SelectListBase extends HTMLElement {
     this.options.addEventListener("dblclick", () => this.hiddenSelect.dispatchEvent(new Event("dblclick")));
   }
 
+  disconnectedCallback(): void {
+    this.dropdownMenu?.remove();
+  }
+
   protected abstract globalClickEvent(event: MouseEvent): void;
 
   /**