Skip to content

Commit

Permalink
Add integration test for #5507
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Sep 17, 2024
1 parent 21e98d4 commit f69234a
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/issue5507/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) Contributors to 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
http://www.eclipse.org/legal/epl-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: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.mojarra.test</groupId>
<artifactId>pom</artifactId>
<version>4.0.9-SNAPSHOT</version>
</parent>

<artifactId>issue5507</artifactId>
<packaging>war</packaging>

<name>Mojarra ${project.version} - INTEGRATION TESTS - ${project.artifactId}</name>

<dependencies>
<dependency>
<groupId>org.eclipse.mojarra.test</groupId>
<artifactId>base</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Empty file.
36 changes: 36 additions & 0 deletions test/issue5507/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) Contributors to 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
http://www.eclipse.org/legal/epl-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: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0"
>
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
47 changes: 47 additions & 0 deletions test/issue5507/src/main/webapp/issue5507.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<!--
Copyright (c) Contributors to 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
http://www.eclipse.org/legal/epl-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: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<html lang="en"
xmlns:h="jakarta.faces.html"
xmlns:f="jakarta.faces.core"
xmlns:ui="jakarta.faces.facelets"
>
<h:head>
<title>issue5507</title>
</h:head>
<h:body>
<h:form id="form1">
<h:dataTable id="table" value="#{['one','two','three','four']}" var="item">
<h:column>
<h:selectOneRadio id="radio" group="someGroup" styleClass="someStyleClass" style="accent-color: blue;">
<f:selectItem itemValue="#{item}" />
</h:selectOneRadio>
<h:outputLabel for="radio" value="#{item}" />
</h:column>
</h:dataTable>
</h:form>
<h:form id="form2">
<h:selectOneRadio id="radio1" group="someGroup" styleClass="someStyleClass" style="accent-color: red;">
<f:selectItems value="#{['one','two','three','four']}" />
</h:selectOneRadio>
<h:selectOneRadio id="radio2" group="someGroup" styleClass="otherStyleClass" />
<h:selectOneRadio id="radio3" group="someGroup" />
<h:selectOneRadio id="radio4" group="someGroup" style="accent-color: green;" />
</h:form>
</h:body>
</html>
Original file line number Diff line number Diff line change
@@ -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"));
}

}
1 change: 1 addition & 0 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<module>issue5464</module>
<module>issue5488</module>
<module>issue5503</module>
<module>issue5507</module>
</modules>

<properties>
Expand Down

0 comments on commit f69234a

Please sign in to comment.