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 2018/04/04 13:48:14 UTC
[myfaces-tobago] 01/02: TOBAGO-1881 Label-Facet of tc:section and
tc:box are different
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 245fa3bfdd6671cf11ee4e3e5dc5372a2e28228e
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Apr 4 15:47:19 2018 +0200
TOBAGO-1881 Label-Facet of tc:section and tc:box are different
* differences between label-facets of tc:section and tc:box should be
resolved
* tc:section allow more than only tc:out
* the label-string is only rendered if no label-facet is used
* add render types: OutInsideBoxLabel and OutInsideSectionLabel
* improve CSS styles for tc:link inside label-facets
* impl getFacetChildren() utils method
* add a test for headings
* improve demo: add an accordion example for tc:box
---
.../myfaces/tobago/component/RendererTypes.java | 4 ++
.../internal/component/AbstractUISection.java | 15 -----
.../internal/renderkit/renderer/BoxRenderer.java | 24 +++++---
.../internal/renderkit/renderer/InRenderer.java | 11 +---
.../renderer/OutInsideBoxLabelRenderer.java | 45 ++++++++++++++
.../renderer/OutInsideSectionLabelRenderer.java | 45 ++++++++++++++
.../renderkit/renderer/SectionRenderer.java | 17 +++++-
.../taglib/component/OutTagDeclaration.java | 3 +-
.../myfaces/tobago/internal/util/RenderUtils.java | 10 ++++
tobago-core/src/main/resources/scss/_tobago.scss | 7 +++
.../myfaces/tobago/example/demo/BoxController.java | 56 ++++++++++++++++++
.../20-component/050-container/10-box/box.xhtml | 57 ++++++++++++++++++
.../40000-style/100-headings/headings.test.js | 68 ++++++++++++++++++++++
.../40000-style/100-headings/headings.xhtml | 53 +++++++++++++++++
.../webapp/content/40-test/40000-style/style.xhtml | 23 ++++++++
15 files changed, 400 insertions(+), 38 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
index c395688..6c8293c 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
@@ -60,7 +60,9 @@ public enum RendererTypes {
Object,
Operation,
Out,
+ OutInsideBoxLabel,
OutInsideIn,
+ OutInsideSectionLabel,
Page,
Panel,
Popup,
@@ -139,7 +141,9 @@ public enum RendererTypes {
public static final String OBJECT = "Object";
public static final String OPERATION = "Operation";
public static final String OUT = "Out";
+ public static final String OUT_INSIDE_BOX_LABEL = "OutInsideBoxLabel";
public static final String OUT_INSIDE_IN = "OutInsideIn";
+ public static final String OUT_INSIDE_SECTION_LABEL = "OutInsideSectionLabel";
public static final String PAGE = "Page";
public static final String PANEL = "Panel";
public static final String POPUP = "Popup";
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
index 212b0e4e..20f1956 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
@@ -19,13 +19,10 @@
package org.apache.myfaces.tobago.internal.component;
-import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import java.io.IOException;
@@ -38,18 +35,6 @@ public abstract class AbstractUISection extends AbstractUICollapsiblePanel {
private int level;
- public String getLabelToRender() {
-
- final UIComponent facet = ComponentUtils.getFacet(this, Facets.label);
- if (facet instanceof UIOutput) {
- return String.valueOf(((UIOutput) facet).getValue());
- } else if (facet != null) {
- LOG.warn("Wrong type: " + facet.getClass().getName());
- }
-
- return getLabel();
- }
-
public abstract String getLabel();
public abstract String getImage();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/BoxRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/BoxRenderer.java
index 0ace522..f42f612 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/BoxRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/BoxRenderer.java
@@ -19,10 +19,13 @@
package org.apache.myfaces.tobago.internal.renderkit.renderer;
import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.internal.component.AbstractUIBox;
+import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.internal.util.JsonUtils;
+import org.apache.myfaces.tobago.internal.util.RenderUtils;
import org.apache.myfaces.tobago.model.CollapseMode;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
@@ -45,10 +48,6 @@ public class BoxRenderer extends PanelRendererBase {
final TobagoResponseWriter writer = getResponseWriter(facesContext);
final Markup markup = box.getMarkup();
- final UIComponent label = ComponentUtils.getFacet(box, Facets.label);
- final String labelString = box.getLabel();
- final UIComponent bar = ComponentUtils.getFacet(box, Facets.bar);
-
writer.startElement(HtmlElements.DIV);
final boolean collapsed = box.isCollapsed();
@@ -72,17 +71,24 @@ public class BoxRenderer extends PanelRendererBase {
encodeHidden(writer, clientId, collapsed);
}
- if (label != null || labelString != null || bar != null) {
+ final UIComponent labelFacet = ComponentUtils.getFacet(box, Facets.label);
+ final String labelString = box.getLabel();
+ final UIComponent bar = ComponentUtils.getFacet(box, Facets.bar);
+ if (labelFacet != null || labelString != null || bar != null) {
writer.startElement(HtmlElements.DIV);
writer.writeClassAttribute(BootstrapClass.CARD_HEADER, TobagoClass.BOX__HEADER);
writer.startElement(HtmlElements.H3);
- if (labelString != null) {
+ if (labelFacet != null) {
+ for (final UIComponent child : RenderUtils.getFacetChildren(labelFacet)) {
+ if (child instanceof AbstractUIOut) {
+ child.setRendererType(RendererTypes.OutInsideBoxLabel.name());
+ }
+ child.encodeAll(facesContext);
+ }
+ } else if (labelString != null) {
writer.writeText(labelString);
}
- if (label != null) {
- label.encodeAll(facesContext);
- }
writer.endElement(HtmlElements.H3);
if (bar != null) {
bar.encodeAll(facesContext);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
index 08314f2..1cff1d8 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
@@ -44,14 +44,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
import javax.faces.context.FacesContext;
import javax.faces.validator.LengthValidator;
import javax.faces.validator.RegexValidator;
import javax.faces.validator.Validator;
import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
public class InRenderer extends MessageLayoutRendererBase {
@@ -169,13 +166,7 @@ public class InRenderer extends MessageLayoutRendererBase {
final FacesContext facesContext, final TobagoResponseWriter writer, final UIComponent addon,
final boolean isAfterFacet) throws IOException {
if (addon != null) {
- final List<UIComponent> children;
- if (addon instanceof UIPanel) {
- children = addon.getChildren();
- } else {
- children = Collections.singletonList(addon);
- }
- for (final UIComponent child : children) {
+ for (final UIComponent child : RenderUtils.getFacetChildren(addon)) {
if (child instanceof AbstractUIButton && ((AbstractUIButton) child).isParentOfCommands()) {
if (isAfterFacet) {
child.setRendererType(RendererTypes.ButtonInsideInAfter.name());
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutInsideBoxLabelRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutInsideBoxLabelRenderer.java
new file mode 100644
index 0000000..f24990c
--- /dev/null
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutInsideBoxLabelRenderer.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.internal.renderkit.renderer;
+
+import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
+import org.apache.myfaces.tobago.renderkit.css.CssItem;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+
+public class OutInsideBoxLabelRenderer extends OutRenderer {
+
+ @Override
+ public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
+ encodeBeginField(facesContext, component);
+ }
+
+ @Override
+ public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
+ encodeEndField(facesContext, component);
+ }
+
+ @Override
+ protected CssItem[] getCssItems(final FacesContext facesContext, final AbstractUIOut out) {
+ return new CssItem[]{};
+ }
+}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutInsideSectionLabelRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutInsideSectionLabelRenderer.java
new file mode 100644
index 0000000..137e756
--- /dev/null
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutInsideSectionLabelRenderer.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.internal.renderkit.renderer;
+
+import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
+import org.apache.myfaces.tobago.renderkit.css.CssItem;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+
+public class OutInsideSectionLabelRenderer extends OutRenderer {
+
+ @Override
+ public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
+ encodeBeginField(facesContext, component);
+ }
+
+ @Override
+ public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
+ encodeEndField(facesContext, component);
+ }
+
+ @Override
+ protected CssItem[] getCssItems(final FacesContext facesContext, final AbstractUIOut out) {
+ return new CssItem[]{};
+ }
+}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SectionRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SectionRenderer.java
index b19135f..37cad4e 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SectionRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SectionRenderer.java
@@ -20,10 +20,13 @@
package org.apache.myfaces.tobago.internal.renderkit.renderer;
import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.context.Markup;
+import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
import org.apache.myfaces.tobago.internal.component.AbstractUISection;
import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.internal.util.JsonUtils;
+import org.apache.myfaces.tobago.internal.util.RenderUtils;
import org.apache.myfaces.tobago.model.CollapseMode;
import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
@@ -56,7 +59,6 @@ public class SectionRenderer extends PanelRendererBase {
section.getCustomClass());
HtmlRendererUtils.writeDataAttributes(facesContext, writer, section);
- final String label = section.getLabelToRender();
final HtmlElements tag;
switch (section.getLevel()) {
case 1:
@@ -89,9 +91,18 @@ public class SectionRenderer extends PanelRendererBase {
final String image = section.getImage();
HtmlRendererUtils.encodeIconOrImage(writer, image);
- if (label != null) {
+ final UIComponent labelFacet = ComponentUtils.getFacet(section, Facets.label);
+ final String labelString = section.getLabel();
+ if (labelFacet != null) {
+ for (final UIComponent child : RenderUtils.getFacetChildren(labelFacet)) {
+ if (child instanceof AbstractUIOut) {
+ child.setRendererType(RendererTypes.OutInsideSectionLabel.name());
+ }
+ child.encodeAll(facesContext);
+ }
+ } else if (labelString != null) {
writer.startElement(HtmlElements.SPAN);
- writer.writeText(label);
+ writer.writeText(labelString);
writer.endElement(HtmlElements.SPAN);
}
writer.endElement(tag);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
index 850e018..c9ff517 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
@@ -46,7 +46,8 @@ import javax.faces.component.UIOutput;
uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIOut",
uiComponentFacesClass = "javax.faces.component.UIOutput",
componentFamily = UIOutput.COMPONENT_FAMILY,
- rendererType = {RendererTypes.OUT, RendererTypes.OUT_INSIDE_IN},
+ rendererType = {RendererTypes.OUT, RendererTypes.OUT_INSIDE_BOX_LABEL, RendererTypes.OUT_INSIDE_IN,
+ RendererTypes.OUT_INSIDE_SECTION_LABEL},
interfaces = {
// As long as no behavior event names are defined, ClientBehaviorHolder must be implemented for Majorra.
"javax.faces.component.behavior.ClientBehaviorHolder"
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/RenderUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/RenderUtils.java
index 8dde859..3fbcf33 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/RenderUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/RenderUtils.java
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
import javax.faces.application.ViewHandler;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
import javax.faces.component.UIParameter;
import javax.faces.component.ValueHolder;
import javax.faces.component.behavior.AjaxBehavior;
@@ -51,6 +52,7 @@ import javax.faces.render.ClientBehaviorRenderer;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -388,4 +390,12 @@ public final class RenderUtils {
}
}
}
+
+ public static List<UIComponent> getFacetChildren(UIComponent facet) {
+ if (facet instanceof UIPanel) {
+ return facet.getChildren();
+ } else {
+ return Collections.singletonList(facet);
+ }
+ }
}
diff --git a/tobago-core/src/main/resources/scss/_tobago.scss b/tobago-core/src/main/resources/scss/_tobago.scss
index 519413c..901b6d3 100644
--- a/tobago-core/src/main/resources/scss/_tobago.scss
+++ b/tobago-core/src/main/resources/scss/_tobago.scss
@@ -43,6 +43,7 @@ $gray-700: #495057 !default;
$gray-800: #343a40 !default;
$gray-900: #212529 !default;
$black: #000 !default;
+$headings-font-weight: 500;
$navbar-dark-active-color: rgba($white, 1) !default;
$navbar-light-active-color: rgba($black, .9) !default;
$border-width: 1px !default;
@@ -390,6 +391,12 @@ a.tobago-link.dropdown-item {
}
}
+h1, h2, h3, h4, h5, h6 {
+ button.tobago-link {
+ font-weight: $headings-font-weight;
+ }
+}
+
button {
&.tobago-link, &.tobago-treeCommand {
color: $blue;
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BoxController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BoxController.java
new file mode 100644
index 0000000..70e0f11
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BoxController.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.example.demo;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@Named
+@SessionScoped
+public class BoxController implements Serializable {
+ private boolean box1collapsed = true;
+ private boolean box2collapsed = true;
+ private boolean box3collapsed = true;
+
+ public boolean isBox1collapsed() {
+ return box1collapsed;
+ }
+
+ public void setBox1collapsed(boolean box1collapsed) {
+ this.box1collapsed = box1collapsed;
+ }
+
+ public boolean isBox2collapsed() {
+ return box2collapsed;
+ }
+
+ public void setBox2collapsed(boolean box2collapsed) {
+ this.box2collapsed = box2collapsed;
+ }
+
+ public boolean isBox3collapsed() {
+ return box3collapsed;
+ }
+
+ public void setBox3collapsed(boolean box3collapsed) {
+ this.box3collapsed = box3collapsed;
+ }
+}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/10-box/box.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/10-box/box.xhtml
index 89caab2..0368d24 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/10-box/box.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/10-box/box.xhtml
@@ -86,4 +86,61 @@
</tc:box>
</tc:box>
</tc:section>
+
+ <tc:section label="Accordion">
+ <tc:box id="accordionBox1" collapsedMode="hidden" collapsed="#{boxController.box1collapsed}">
+ <f:facet name="label">
+ <tc:link label="Box 1" rendered="#{boxController.box1collapsed}">
+ <tc:operation for="accordionBox1" name="show"/>
+ <f:ajax execute="accordionBox1" render="accordionBox1"/>
+ </tc:link>
+ <tc:link label="Box 1" rendered="#{!boxController.box1collapsed}">
+ <tc:operation for="accordionBox1" name="hide"/>
+ <f:ajax execute="accordionBox1" render="accordionBox1"/>
+ </tc:link>
+ </f:facet>
+ <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore
+ et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
+ Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
+ consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
+ sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
+ takimata sanctus est Lorem ipsum dolor sit amet.</p>
+ </tc:box>
+ <tc:box id="accordionBox2" collapsedMode="hidden" collapsed="#{boxController.box2collapsed}">
+ <f:facet name="label">
+ <tc:link label="Box 2" rendered="#{boxController.box2collapsed}">
+ <tc:operation for="accordionBox2" name="show"/>
+ <f:ajax execute="accordionBox2" render="accordionBox2"/>
+ </tc:link>
+ <tc:link label="Box 2" rendered="#{!boxController.box2collapsed}">
+ <tc:operation for="accordionBox2" name="hide"/>
+ <f:ajax execute="accordionBox2" render="accordionBox2"/>
+ </tc:link>
+ </f:facet>
+ <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore
+ et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
+ Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
+ consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
+ sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
+ takimata sanctus est Lorem ipsum dolor sit amet.</p>
+ </tc:box>
+ <tc:box id="accordionBox3" collapsedMode="hidden" collapsed="#{boxController.box3collapsed}">
+ <f:facet name="label">
+ <tc:link label="Box 3" rendered="#{boxController.box3collapsed}">
+ <tc:operation for="accordionBox3" name="show"/>
+ <f:ajax execute="accordionBox3" render="accordionBox3"/>
+ </tc:link>
+ <tc:link label="Box 3" rendered="#{!boxController.box3collapsed}">
+ <tc:operation for="accordionBox3" name="hide"/>
+ <f:ajax execute="accordionBox3" render="accordionBox3"/>
+ </tc:link>
+ </f:facet>
+ <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore
+ et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
+ Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
+ consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
+ sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
+ takimata sanctus est Lorem ipsum dolor sit amet.</p>
+ </tc:box>
+ </tc:section>
</ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/100-headings/headings.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/100-headings/headings.test.js
new file mode 100644
index 0000000..f83ab7c
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/100-headings/headings.test.js
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+QUnit.test("Test h1", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link1");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink1");
+ testFont(assert, $alink, $buttonlink);
+});
+
+QUnit.test("Test h2", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link2");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink2");
+ testFont(assert, $alink, $buttonlink);
+});
+
+QUnit.test("Test h3", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link3");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink3");
+ testFont(assert, $alink, $buttonlink);
+});
+
+QUnit.test("Test h4", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link4");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink4");
+ testFont(assert, $alink, $buttonlink);
+});
+
+QUnit.test("Test h5", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link5");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink5");
+ testFont(assert, $alink, $buttonlink);
+});
+
+QUnit.test("Test h6", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link6");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink6");
+ testFont(assert, $alink, $buttonlink);
+});
+
+QUnit.test("Test no heading", function (assert) {
+ var $alink = jQueryFrame("#page\\:mainForm\\:link0");
+ var $buttonlink = jQueryFrame("#page\\:mainForm\\:actionLink0");
+ testFont(assert, $alink, $buttonlink);
+});
+
+function testFont(assert, $alink, $buttonlink) {
+ assert.expect(5);
+
+ assert.equal($alink.css("color"), $buttonlink.css("color"));
+ assert.equal($alink.css("font-family"), $buttonlink.css("font-family"));
+ assert.equal($alink.css("font-size"), $buttonlink.css("font-size"));
+ assert.equal($alink.css("font-weight"), $buttonlink.css("font-weight"));
+ assert.equal($alink.css("text-decoration"), $buttonlink.css("text-decoration"));
+}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/100-headings/headings.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/100-headings/headings.xhtml
new file mode 100644
index 0000000..b11e917
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/100-headings/headings.xhtml
@@ -0,0 +1,53 @@
+<!--
+ * 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:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <ui:param name="title" value="Components in heading tags"/>
+ <tc:box id="headingsBox" label="Links">
+ <p>The fonts of the apache.org-link and the ActionLink must be the same.</p>
+ <h1>H1
+ <tc:link id="link1" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink1" label="ActionLink"/>
+ </h1>
+ <h2>H2
+ <tc:link id="link2" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink2" label="ActionLink"/>
+ </h2>
+ <h3>H3
+ <tc:link id="link3" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink3" label="ActionLink"/>
+ </h3>
+ <h4>H4
+ <tc:link id="link4" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink4" label="ActionLink"/>
+ </h4>
+ <h5>H5
+ <tc:link id="link5" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink5" label="ActionLink"/>
+ </h5>
+ <h6>H6
+ <tc:link id="link6" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink6" label="ActionLink"/>
+ </h6>
+ <p>no heading
+ <tc:link id="link0" label="apache.org" link="https://www.apache.org/"/>
+ <tc:link id="actionLink0" label="ActionLink"/></p>
+ </tc:box>
+</ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/style.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/style.xhtml
new file mode 100644
index 0000000..e41b65f
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/40000-style/style.xhtml
@@ -0,0 +1,23 @@
+<!--
+ * 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:ui="http://java.sun.com/jsf/facelets">
+ <ui:param name="title" value="Style tests"/>
+ <p>Automated tests for styling.</p>
+</ui:composition>
--
To stop receiving notification emails like this one, please contact
hnoeth@apache.org.