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 2022/11/22 09:08:38 UTC

[myfaces-tobago] branch tobago-5.x updated: fix(links): vertical mode

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


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new 550da206b3 fix(links): vertical mode
550da206b3 is described below

commit 550da206b32f62b1481e7faa58482944548191cb
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Nov 22 09:58:01 2022 +0100

    fix(links): vertical mode
    
    Issue: TOBAGO-2170
---
 .../internal/renderkit/renderer/LinksRenderer.java |  4 +--
 .../040-command/25-links/Link_Group.test.js        | 30 ++++++++++++++++++++++
 .../content/040-command/25-links/Link_Group.xhtml  | 14 +++++-----
 3 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LinksRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LinksRenderer.java
index 1e0344a5ee..a22f19b65a 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LinksRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LinksRenderer.java
@@ -45,12 +45,12 @@ public class LinksRenderer<T extends AbstractUILinks> extends RendererBase<T> {
     writer.startElement(HtmlElements.TOBAGO_LINKS);
     writer.writeIdAttribute(component.getClientId(facesContext));
     writer.writeClassAttribute(
-        Orientation.vertical.equals(component.getOrientation()) ? BootstrapClass.FLEX_COLUMN : null,
         autoSpacing ? TobagoClass.AUTO__SPACING : null,
         component.getCustomClass());
     writer.startElement(HtmlElements.UL);
     writer.writeClassAttribute(
-        insideBar ? BootstrapClass.NAVBAR_NAV : BootstrapClass.NAV);
+        insideBar ? BootstrapClass.NAVBAR_NAV : BootstrapClass.NAV,
+        Orientation.vertical.equals(component.getOrientation()) ? BootstrapClass.FLEX_COLUMN : null);
   }
 
   @Override
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.test.js
new file mode 100644
index 0000000000..578a5eb2c0
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.test.js
@@ -0,0 +1,30 @@
+/*
+ * 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, querySelectorFn} from "/script/tobago-test.js";
+
+it("vertical link group", function (done) {
+  const topFn = elementByIdFn("page:mainForm:verticalGroupTop");
+  const middleFn = elementByIdFn("page:mainForm:verticalGroupMiddle");
+  const bottomFn = elementByIdFn("page:mainForm:verticalGroupBottom");
+
+  const test = new JasmineTestTool(done);
+  test.do(() => expect(topFn().offsetTop).toBeLessThan(middleFn().offsetTop));
+  test.do(() => expect(middleFn().offsetTop).toBeLessThan(bottomFn().offsetTop));
+  test.start();
+});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.xhtml
index e8e7804deb..21cfd50295 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/040-command/25-links/Link_Group.xhtml
@@ -79,14 +79,14 @@
   <tc:section label="Vertical">
     <p>Vertical link group.</p>
     <demo-highlight language="markup">&lt;tc:links orientation="vertical">
-  &lt;tc:link label="Left"/>
-  &lt;tc:link label="Center"/>
-  &lt;tc:link label="Right"/>
+  &lt;tc:link label="Top"/>
+  &lt;tc:link label="Middle"/>
+  &lt;tc:link label="Bottom"/>
 &lt;/tc:links></demo-highlight>
-    <tc:links orientation="vertical">
-      <tc:link label="Left"/>
-      <tc:link label="Center"/>
-      <tc:link label="Right"/>
+    <tc:links id="verticalGroup" orientation="vertical">
+      <tc:link id="verticalGroupTop" label="Top"/>
+      <tc:link id="verticalGroupMiddle" label="Middle"/>
+      <tc:link id="verticalGroupBottom" label="Bottom"/>
     </tc:links>
   </tc:section>