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:34 UTC
[myfaces-tobago] branch main updated: fix(links): vertical mode
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 8a84d144f7 fix(links): vertical mode
8a84d144f7 is described below
commit 8a84d144f771975e02358a90debc2756669dccbc
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 8c44507409..f7cf964ac6 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
@@ -46,12 +46,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"><tc:links orientation="vertical">
- <tc:link label="Left"/>
- <tc:link label="Center"/>
- <tc:link label="Right"/>
+ <tc:link label="Top"/>
+ <tc:link label="Middle"/>
+ <tc:link label="Bottom"/>
</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>