Update hidden tag to support being disabled per WW-2566. Thanks to Jelmer Kuperus for the patch.

I added a unit test as well.

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@660539 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Holmes
2008-05-27 14:42:46 +00:00
parent 36d82cbc7f
commit 43d1be3774
4 changed files with 22 additions and 1 deletions
@@ -34,5 +34,8 @@
<#if parameters.cssStyle?exists>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" />
/>
+1 -1
View File
@@ -113,7 +113,7 @@ Please do not edit it directly.
<td align="left" valign="top">:</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">String that will be appended to the labe</td>
<td align="left" valign="top">String that will be appended to the label</td>
</tr>
<tr>
<td align="left" valign="top">labelposition</td>
@@ -48,6 +48,23 @@ public class HiddenTest extends AbstractUITagTest {
verify(TextFieldTag.class.getResource("Hidden-1.txt"));
}
public void testDisabled() throws Exception {
TestAction testAction = (TestAction) action;
testAction.setFoo("bar");
HiddenTag tag = new HiddenTag();
tag.setPageContext(pageContext);
tag.setLabel("mylabel");
tag.setName("myname");
tag.setValue("%{foo}");
tag.setDisabled("true");
tag.doStartTag();
tag.doEndTag();
verify(TextFieldTag.class.getResource("Hidden-2.txt"));
}
/**
* 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,
@@ -0,0 +1 @@
<input type="hidden" name="myname" value="bar" id="myname" disabled="disabled"/>