struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [struts] 01/01: WW-5081 Makes textarea compatible with W3C
Date Fri, 03 Jul 2020 06:50:17 GMT
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5081-cols-rows
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 0d622cfa96dbbc1e286347f30a7527505aeb0ed0
Author: Lukasz Lenart <lukaszlenart@apache.org>
AuthorDate: Fri Jul 3 08:50:04 2020 +0200

    WW-5081 Makes textarea compatible with W3C
---
 .../main/resources/template/simple/textarea.ftl    |  4 ++++
 .../apache/struts2/views/jsp/ui/TextareaTest.java  | 24 ++++++++++++++++++++++
 .../org/apache/struts2/views/jsp/ui/Textarea-2.txt |  4 ++++
 3 files changed, 32 insertions(+)

diff --git a/core/src/main/resources/template/simple/textarea.ftl b/core/src/main/resources/template/simple/textarea.ftl
index 54e935c..22f2d9b 100644
--- a/core/src/main/resources/template/simple/textarea.ftl
+++ b/core/src/main/resources/template/simple/textarea.ftl
@@ -20,8 +20,12 @@
 -->
 <textarea<#rt/>
  name="${(parameters.name!"")}"<#rt/>
+<#if parameters.cols?has_content>
  cols="${(parameters.cols!"")}"<#rt/>
+</#if>
+<#if parameters.rows?has_content>
  rows="${(parameters.rows!"")}"<#rt/>
+</#if>
 <#if parameters.wrap?has_content>
  wrap="${parameters.wrap}"<#rt/>
 </#if>
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java
index 3dc7630..ddd0506 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java
@@ -54,6 +54,30 @@ public class TextareaTest extends AbstractUITagTest {
         verify(TextareaTag.class.getResource("Textarea-1.txt"));
     }
 
+    public void testNoColsAndRows() throws Exception {
+        TestAction testAction = (TestAction) action;
+        testAction.setFoo("bar");
+
+        TextareaTag tag = new TextareaTag();
+        tag.setPageContext(pageContext);
+        tag.setLabel("mylabel");
+        tag.setName("myname");
+        tag.setValue("%{foo}");
+        tag.setTitle("mytitle");
+        tag.setDisabled("true");
+        tag.setTabindex("5");
+        tag.setOnchange("alert('goodbye');");
+        tag.setOnclick("alert('onclick');");
+        tag.setId("the_id");
+        tag.setOnkeyup("alert('hello');");
+        tag.setReadonly("true");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(TextareaTag.class.getResource("Textarea-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,
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt
new file mode 100644
index 0000000..69c05c0
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt
@@ -0,0 +1,4 @@
+<tr>
+    <td class="tdLabel"><label for="the_id" class="label">mylabel:</label></td>
+    <td class="tdInput"><textarea name="myname" disabled="disabled" readonly="readonly"
tabindex="5" id="the_id" title="mytitle" onclick="alert('onclick');" onkeyup="alert('hello');"
onchange="alert('goodbye');">bar</textarea></td>
+</tr>


Mime
View raw message