From f69234ab26d75169dff80ccbcbb2b487b3b1c47b Mon Sep 17 00:00:00 2001 From: Bauke Scholtz Date: Tue, 17 Sep 2024 10:45:17 -0400 Subject: [PATCH] Add integration test for #5507 --- test/issue5507/pom.xml | 41 +++++++++ .../src/main/webapp/WEB-INF/beans.xml | 0 .../issue5507/src/main/webapp/WEB-INF/web.xml | 36 ++++++++ .../issue5507/src/main/webapp/issue5507.xhtml | 47 ++++++++++ .../mojarra/test/issue5507/Issue5507IT.java | 86 +++++++++++++++++++ test/pom.xml | 1 + 6 files changed, 211 insertions(+) create mode 100644 test/issue5507/pom.xml create mode 100644 test/issue5507/src/main/webapp/WEB-INF/beans.xml create mode 100644 test/issue5507/src/main/webapp/WEB-INF/web.xml create mode 100644 test/issue5507/src/main/webapp/issue5507.xhtml create mode 100644 test/issue5507/src/test/java/org/eclipse/mojarra/test/issue5507/Issue5507IT.java diff --git a/test/issue5507/pom.xml b/test/issue5507/pom.xml new file mode 100644 index 0000000000..89ebfcdb45 --- /dev/null +++ b/test/issue5507/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + + + org.eclipse.mojarra.test + pom + 4.0.9-SNAPSHOT + + + issue5507 + war + + Mojarra ${project.version} - INTEGRATION TESTS - ${project.artifactId} + + + + org.eclipse.mojarra.test + base + ${project.version} + test + + + diff --git a/test/issue5507/src/main/webapp/WEB-INF/beans.xml b/test/issue5507/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/issue5507/src/main/webapp/WEB-INF/web.xml b/test/issue5507/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..31ee2d0dbe --- /dev/null +++ b/test/issue5507/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,36 @@ + + + + + facesServlet + jakarta.faces.webapp.FacesServlet + 1 + + + facesServlet + *.xhtml + *.jsf + /faces/* + + diff --git a/test/issue5507/src/main/webapp/issue5507.xhtml b/test/issue5507/src/main/webapp/issue5507.xhtml new file mode 100644 index 0000000000..1611cdd893 --- /dev/null +++ b/test/issue5507/src/main/webapp/issue5507.xhtml @@ -0,0 +1,47 @@ + + + + + issue5507 + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/issue5507/src/test/java/org/eclipse/mojarra/test/issue5507/Issue5507IT.java b/test/issue5507/src/test/java/org/eclipse/mojarra/test/issue5507/Issue5507IT.java new file mode 100644 index 0000000000..f483bca887 --- /dev/null +++ b/test/issue5507/src/test/java/org/eclipse/mojarra/test/issue5507/Issue5507IT.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GPL-2.0 with Classpath-exception-2.0 which + * is available at https://openjdk.java.net/legal/gplv2+ce.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 or Apache-2.0 + */ +package org.eclipse.mojarra.test.issue5507; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.eclipse.mojarra.test.base.BaseIT; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +/** + * https://github.com/eclipse-ee4j/mojarra/issues/5507 + */ +class Issue5507IT extends BaseIT { + + @FindBy(id = "form1:table:0:radio") + private WebElement form1Radio1; + + @FindBy(id = "form1:table:1:radio") + private WebElement form1Radio2; + + @FindBy(id = "form1:table:2:radio") + private WebElement form1Radio3; + + @FindBy(id = "form1:table:3:radio") + private WebElement form1Radio4; + + @FindBy(id = "form2:radio1") + private WebElement form2Radio1; + + @FindBy(id = "form2:radio2") + private WebElement form2Radio2; + + @FindBy(id = "form2:radio3") + private WebElement form2Radio3; + + @FindBy(id = "form2:radio4") + private WebElement form2Radio4; + + @Test + void testSelectOneRadioStyleClassAttributeRendering() { + open("issue5507.xhtml"); + + String pageSource = getPageSource(); + System.out.println("================================================"); + System.out.println(pageSource); + System.out.println("================================================"); + + assertEquals("someStyleClass", form1Radio1.getAttribute("class")); + assertEquals("someStyleClass", form1Radio2.getAttribute("class")); + assertEquals("someStyleClass", form1Radio3.getAttribute("class")); + assertEquals("someStyleClass", form1Radio4.getAttribute("class")); + assertEquals("someStyleClass", form2Radio1.getAttribute("class")); + assertEquals("otherStyleClass", form2Radio2.getAttribute("class")); + assertEquals("", form2Radio3.getAttribute("class")); + assertEquals("", form2Radio4.getAttribute("class")); + } + + @Test + void testSelectOneRadioStyleAttributeRendering() { + open("issue5507.xhtml"); + assertEquals("accent-color: blue;", form1Radio1.getAttribute("style")); + assertEquals("accent-color: blue;", form1Radio2.getAttribute("style")); + assertEquals("accent-color: blue;", form1Radio3.getAttribute("style")); + assertEquals("accent-color: blue;", form1Radio4.getAttribute("style")); + assertEquals("accent-color: red;", form2Radio1.getAttribute("style")); + assertEquals("", form2Radio2.getAttribute("style")); + assertEquals("", form2Radio3.getAttribute("style")); + assertEquals("accent-color: green;", form2Radio4.getAttribute("style")); + } + +} diff --git a/test/pom.xml b/test/pom.xml index 4c7a1133cb..04ded8897b 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -37,6 +37,7 @@ issue5464 issue5488 issue5503 + issue5507