WW-4297 finishes feature: improves hidden tag to properly support xhtml theme

This commit is contained in:
Lukasz Lenart
2014-03-13 20:21:50 +01:00
6 changed files with 51 additions and 10 deletions
@@ -65,4 +65,11 @@ public class Hidden extends UIBean {
protected String getDefaultTemplate() {
return TEMPLATE;
}
@Override
public void evaluateParams() {
super.evaluateParams();
label = null;
addParameter("label", null);
}
}
@@ -0,0 +1,25 @@
<#--
/*
* $Id$
*
* 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.
*/
-->
<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/hidden.ftl" />
<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" />
@@ -21,15 +21,12 @@
package org.apache.struts2;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.XWorkTestCase;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.util.XWorkTestCaseHelper;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.opensymphony.xwork2.util.logging.jdk.JdkLoggerFactory;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.util.StrutsTestCaseHelper;
import org.springframework.mock.web.MockServletContext;
import org.apache.struts2.views.jsp.StrutsMockServletContext;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -75,6 +72,7 @@ public abstract class StrutsInternalTestCase extends XWorkTestCase {
LoggerFactory.setLoggerFactory(new JdkLoggerFactory());
}
protected StrutsMockServletContext servletContext;
protected Dispatcher dispatcher;
/**
@@ -87,7 +85,8 @@ public abstract class StrutsInternalTestCase extends XWorkTestCase {
}
protected Dispatcher initDispatcher(Map<String,String> params) {
dispatcher = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params);
servletContext = new StrutsMockServletContext();
dispatcher = StrutsTestCaseHelper.initDispatcher(servletContext, params);
configurationManager = dispatcher.getConfigurationManager();
configuration = configurationManager.getConfiguration();
container = configuration.getContainer();
@@ -61,7 +61,6 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase {
protected StrutsMockHttpServletRequest request;
protected StrutsMockPageContext pageContext;
protected HttpServletResponse response;
protected StrutsMockServletContext servletContext;
protected Mock mockContainer;
@@ -83,7 +82,7 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase {
createMocks();
}
protected void createMocks() {
protected void createMocks() throws Exception {
action = this.getAction();
stack = ActionContext.getContext().getValueStack();
context = stack.getContext();
@@ -99,7 +98,6 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase {
JspWriter jspWriter = new StrutsMockJspWriter(writer);
servletContext = new StrutsMockServletContext();
servletContext.setRealPath(new File("nosuchfile.properties").getAbsolutePath());
servletContext.setServletInfo("Resin");
@@ -1 +1,7 @@
<input type="hidden" name="myname" value="bar" id="myname"/>
<tr>
<td class="tdLabel">
</td>
<td>
<input type="hidden" name="myname" value="bar" id="myname"/>
</td>
</tr>
@@ -1 +1,7 @@
<input type="hidden" name="myname" value="bar" id="myname" disabled="disabled"/>
<tr>
<td class="tdLabel">
</td>
<td>
<input type="hidden" name="myname" value="bar" id="myname" disabled="disabled"/>
</td>
</tr>