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/11/08 09:49:13 UTC
[myfaces-tobago] branch tobago-5.x updated: test: badge-warning
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 7ef5acb test: badge-warning
7ef5acb is described below
commit 7ef5acb6f1782a693b12b91783f7550f687d3216
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Nov 8 10:47:43 2021 +0100
test: badge-warning
---
.../renderer/ButtonsRendererUnitTest.java | 20 ++++++++++++++++++++
.../buttons/badgeWarning-inside-buttons.html | 22 ++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonsRendererUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonsRendererUnitTest.java
index 0a5014f..feb5c73 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonsRendererUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonsRendererUnitTest.java
@@ -26,6 +26,7 @@ import org.apache.myfaces.tobago.component.UIButton;
import org.apache.myfaces.tobago.component.UIButtons;
import org.apache.myfaces.tobago.component.UILink;
import org.apache.myfaces.tobago.component.UISeparator;
+import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -88,4 +89,23 @@ public class ButtonsRendererUnitTest extends RendererTestBase {
Assertions.assertEquals(loadHtml("renderer/buttons/badge-inside-buttons.html"), formattedResult());
}
+ @Test
+ public void badgeWarningInsideButtons() throws IOException {
+ final UIButtons l = (UIButtons) ComponentUtils.createComponent(
+ facesContext, Tags.buttons.componentType(), RendererTypes.Buttons, "list");
+ final UIBadge b = (UIBadge) ComponentUtils.createComponent(
+ facesContext, Tags.badge.componentType(), RendererTypes.Badge, "badge");
+ b.setMarkup(Markup.WARNING);
+ final UIButton c = (UIButton) ComponentUtils.createComponent(
+ facesContext, Tags.button.componentType(), RendererTypes.Button, "id");
+ c.setLabel("button");
+
+ l.getChildren().add(b);
+ l.getChildren().add(c);
+
+ l.encodeAll(facesContext);
+
+ Assertions.assertEquals(loadHtml("renderer/buttons/badgeWarning-inside-buttons.html"), formattedResult());
+ }
+
}
diff --git a/tobago-core/src/test/resources/renderer/buttons/badgeWarning-inside-buttons.html b/tobago-core/src/test/resources/renderer/buttons/badgeWarning-inside-buttons.html
new file mode 100644
index 0000000..4314dd0
--- /dev/null
+++ b/tobago-core/src/test/resources/renderer/buttons/badgeWarning-inside-buttons.html
@@ -0,0 +1,22 @@
+<!--
+ * 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-buttons id='list' class='btn-group tobago-auto-spacing' role='group'>
+ <tobago-badge id='badge' class='badge bg-warning btn'>
+ </tobago-badge>
+ <button type='button' id='id' name='id' class='tobago-button btn btn-secondary'><tobago-behavior event='click' client-id='id'></tobago-behavior><span>button</span></button>
+</tobago-buttons>
\ No newline at end of file