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 2021/06/28 11:05:58 UTC

[myfaces-tobago] branch master updated: test(out): customClass

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


The following commit(s) were added to refs/heads/master by this push:
     new 6973ac9  test(out): customClass
6973ac9 is described below

commit 6973ac9e5aa72cf73a2f67e1138ef7ae7c32dea2
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Jun 28 12:30:21 2021 +0200

    test(out): customClass
---
 .../renderkit/renderer/OutRendererUnitTest.java    | 25 +++++++++++++++++++++-
 .../src/test/resources/renderer/out/outLabel.html  | 18 ++++++++++++++++
 .../renderer/out/outLabelCustomClass.html          | 18 ++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRendererUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRendererUnitTest.java
index a860a4f..4f6ef4c 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRendererUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRendererUnitTest.java
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.internal.renderkit.renderer;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.Tags;
 import org.apache.myfaces.tobago.component.UIOut;
+import org.apache.myfaces.tobago.renderkit.css.CustomClass;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
@@ -31,7 +32,7 @@ import java.io.IOException;
 public class OutRendererUnitTest extends RendererTestBase {
 
   @Test
-  public void inputGroupButtonAfter() throws IOException {
+  public void out() throws IOException {
     final UIOut c = (UIOut) ComponentUtils.createComponent(
         facesContext, Tags.out.componentType(), RendererTypes.Out, "id");
     c.setValue("out");
@@ -41,4 +42,26 @@ public class OutRendererUnitTest extends RendererTestBase {
     Assertions.assertEquals(loadHtml("renderer/out/out.html"), formattedResult());
   }
 
+  @Test
+  public void outLabel() throws IOException {
+    final UIOut c = (UIOut) ComponentUtils.createComponent(
+        facesContext, Tags.out.componentType(), RendererTypes.Out, "id");
+    c.setValue("out");
+    c.setLabel("label");
+    c.encodeAll(facesContext);
+
+    Assertions.assertEquals(loadHtml("renderer/out/outLabel.html"), formattedResult());
+  }
+
+  @Test
+  public void outLabelCustomClass() throws IOException {
+    final UIOut c = (UIOut) ComponentUtils.createComponent(
+        facesContext, Tags.out.componentType(), RendererTypes.Out, "id");
+    c.setValue("out");
+    c.setLabel("label");
+    c.setCustomClass(new CustomClass("custom-class"));
+    c.encodeAll(facesContext);
+
+    Assertions.assertEquals(loadHtml("renderer/out/outLabelCustomClass.html"), formattedResult());
+  }
 }
diff --git a/tobago-core/src/test/resources/renderer/out/outLabel.html b/tobago-core/src/test/resources/renderer/out/outLabel.html
new file mode 100644
index 0000000..6984e7a
--- /dev/null
+++ b/tobago-core/src/test/resources/renderer/out/outLabel.html
@@ -0,0 +1,18 @@
+<!--
+ * 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.
+-->
+
+<tobago-out id='id' class='tobago-label-container tobago-auto-spacing'><label for='id' class='col-form-label'>label</label><span class='form-control-plaintext'>out</span></tobago-out>
diff --git a/tobago-core/src/test/resources/renderer/out/outLabelCustomClass.html b/tobago-core/src/test/resources/renderer/out/outLabelCustomClass.html
new file mode 100644
index 0000000..2a54ad5
--- /dev/null
+++ b/tobago-core/src/test/resources/renderer/out/outLabelCustomClass.html
@@ -0,0 +1,18 @@
+<!--
+ * 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.
+-->
+
+<tobago-out id='id' class='tobago-label-container tobago-auto-spacing'><label for='id' class='col-form-label'>label</label><span class='custom-class form-control-plaintext'>out</span></tobago-out>