mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
WW-5257 Cleans up template
This commit is contained in:
@@ -45,4 +45,4 @@
|
||||
disabled="disabled"<#rt/>
|
||||
</#if>
|
||||
/>
|
||||
</#if>
|
||||
</#if><#rt/>
|
||||
|
||||
@@ -19,5 +19,5 @@
|
||||
*/
|
||||
-->
|
||||
<#if parameters.accesskey?has_content>
|
||||
accesskey="${parameters.accesskey}"
|
||||
</#if>
|
||||
accesskey="${parameters.accesskey}"<#rt/>
|
||||
</#if><#rt/>
|
||||
|
||||
@@ -106,12 +106,11 @@ ${parameters.label}<#t/>
|
||||
</#if>
|
||||
</td>
|
||||
<td class="tdCheckboxInput">
|
||||
|
||||
<#if (labelPos!"") != 'top'>
|
||||
<#include "/${parameters.templateDir}/simple/checkbox.ftl" />
|
||||
</#if>
|
||||
<#if (labelPos!"") != 'top' && (labelPos!"") != 'left'>
|
||||
<#if parameters.label??> <label<#t/>
|
||||
<#if parameters.label??><label<#rt/>
|
||||
<#if parameters.id??>
|
||||
for="${parameters.id}"<#rt/>
|
||||
</#if>
|
||||
@@ -124,4 +123,4 @@ ${parameters.label}<#t/>
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" /><#nt/>
|
||||
<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" /><#nt/>
|
||||
|
||||
@@ -19,22 +19,23 @@
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;
|
||||
import org.apache.struts2.views.jsp.ui.AbstractUITag;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(AbstractUITagTest.class);
|
||||
@@ -47,7 +48,7 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
*
|
||||
* @author <a href="mailto:gielen@it-neering.net">Rene Gielen</a>
|
||||
*/
|
||||
public class PropertyHolder {
|
||||
public static class PropertyHolder {
|
||||
String name, value, expectation;
|
||||
|
||||
public String getName() {
|
||||
@@ -111,18 +112,16 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
* subclasses.
|
||||
*
|
||||
* @return A Map of PropertyHolders values bound to {@link org.apache.struts2.views.jsp.AbstractUITagTest.PropertyHolder#getName()}
|
||||
* as key.
|
||||
* as key.
|
||||
*/
|
||||
protected Map<String, PropertyHolder> initializedGenericTagTestProperties() {
|
||||
Map<String, PropertyHolder> result = new HashMap<String, PropertyHolder>();
|
||||
Map<String, PropertyHolder> result = new HashMap<>();
|
||||
new PropertyHolder("name", "someName").addToMap(result);
|
||||
new PropertyHolder("id", "someId").addToMap(result);
|
||||
new PropertyHolder("cssClass", "cssClass1", "class=\"cssClass1\"").addToMap(result);
|
||||
new PropertyHolder("cssStyle", "cssStyle1", "style=\"cssStyle1\"").addToMap(result);
|
||||
new PropertyHolder("title", "someTitle").addToMap(result);
|
||||
new PropertyHolder("disabled", "true", "disabled=\"disabled\"").addToMap(result);
|
||||
//new PropertyHolder("label", "label", "label=\"label\"").addToMap(result);
|
||||
//new PropertyHolder("required", "someTitle").addToMap(result);
|
||||
new PropertyHolder("tabindex", "99").addToMap(result);
|
||||
new PropertyHolder("value", "someValue").addToMap(result);
|
||||
new PropertyHolder("onclick", "onclick1").addToMap(result);
|
||||
@@ -155,11 +154,11 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
*/
|
||||
public void verifyGenericProperties(AbstractUITag tag, String theme, Map<String, PropertyHolder> propertiesToTest, String[] exclude) throws Exception {
|
||||
if (tag != null && propertiesToTest != null) {
|
||||
List excludeList;
|
||||
List<String> excludeList;
|
||||
if (exclude != null) {
|
||||
excludeList = Arrays.asList(exclude);
|
||||
} else {
|
||||
excludeList = Collections.EMPTY_LIST;
|
||||
excludeList = Collections.emptyList();
|
||||
}
|
||||
|
||||
tag.setPageContext(pageContext);
|
||||
@@ -172,6 +171,9 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
BeanUtils.setProperty(tag, propertyHolder.getName(), propertyHolder.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
tag.setDynamicAttribute(null, "data-id", "id-random");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
String writerString = normalize(writer.toString(), true);
|
||||
@@ -184,6 +186,8 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
assertTrue("Expected to find: " + propertyHolder.getExpectation() + " in resulting String: " + writerString, writerString.contains(propertyHolder.getExpectation()));
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(writerString.contains("data-id=\"id-random\""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,15 +231,15 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
|
||||
|
||||
StringBuilder buffer = new StringBuilder(128);
|
||||
try (InputStream in = url.openStream()) {
|
||||
byte[] buf = new byte[4096];
|
||||
int nbytes;
|
||||
byte[] buf = new byte[4096];
|
||||
int nbytes;
|
||||
|
||||
while ((nbytes = in.read(buf)) > 0) {
|
||||
buffer.append(new String(buf, 0, nbytes));
|
||||
}
|
||||
while ((nbytes = in.read(buf)) > 0) {
|
||||
buffer.append(new String(buf, 0, nbytes));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* compare the trimmed values of each buffer and make sure they're equivalent. however, let's make sure to
|
||||
* normalize the strings first to account for line termination differences between platforms.
|
||||
*/
|
||||
|
||||
@@ -23,14 +23,8 @@ import java.util.Map;
|
||||
import org.apache.struts2.TestAction;
|
||||
import org.apache.struts2.views.jsp.AbstractUITagTest;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CheckboxTest extends AbstractUITagTest {
|
||||
|
||||
public CheckboxTest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a map of {@link org.apache.struts2.views.jsp.AbstractUITagTest.PropertyHolder} for generic tag
|
||||
* property testing. Will be used when calling {@link #verifyGenericProperties(org.apache.struts2.views.jsp.ui.AbstractUITag,
|
||||
@@ -472,7 +466,6 @@ public class CheckboxTest extends AbstractUITagTest {
|
||||
// Test value set
|
||||
tag.setSubmitUnchecked("false");
|
||||
verify(CheckboxTag.class.getResource("Checkbox-7.txt"));
|
||||
|
||||
}
|
||||
|
||||
public void testSubmitUncheckedAsTrue() throws Exception {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title="someTitle" onclick="onclick1" ondblclick="ondblclick1" onmousedown="onmousedown1" onmouseup="onmouseup1"
|
||||
onmouseover="onmouseover1" onmousemove="onmousemove1" onmouseout="onmouseout1" onfocus="onfocus1" onblur="onblur1"
|
||||
onkeypress="onkeypress1" onkeydown="onkeydown1" onkeyup="onkeyup1" onselect="onchange"
|
||||
onchange="someIdRedirect(this.selectedIndex)" select-name="firstName">
|
||||
onchange="someIdRedirect(this.selectedIndex)" select-name="firstName" data-id="id-random">
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="FR" selected="selected">France</option>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user