You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2024/01/19 06:35:18 UTC
(struts) branch fix/WW-5357-disabled created (now 3ec313aa0)
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a change to branch fix/WW-5357-disabled
in repository https://gitbox.apache.org/repos/asf/struts.git
at 3ec313aa0 WW-5357 Adds support for disabled attribute to anchor tag
This branch includes the following new commits:
new 3ec313aa0 WW-5357 Adds support for disabled attribute to anchor tag
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(struts) 01/01: WW-5357 Adds support for disabled attribute to anchor tag
Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch fix/WW-5357-disabled
in repository https://gitbox.apache.org/repos/asf/struts.git
commit 3ec313aa0bbca1061531bac632b37e39ca5c58cc
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Fri Jan 19 07:35:09 2024 +0100
WW-5357 Adds support for disabled attribute to anchor tag
---
core/src/main/resources/template/simple/a-close.ftl | 3 +++
.../org/apache/struts2/views/jsp/ui/AnchorTest.java | 17 +++++++++++++++++
.../org/apache/struts2/views/jsp/ui/href-6.txt | 1 +
3 files changed, 21 insertions(+)
diff --git a/core/src/main/resources/template/simple/a-close.ftl b/core/src/main/resources/template/simple/a-close.ftl
index 4cacaf5ed..1c808e18b 100644
--- a/core/src/main/resources/template/simple/a-close.ftl
+++ b/core/src/main/resources/template/simple/a-close.ftl
@@ -25,6 +25,9 @@
<#if parameters.href??>
href="${parameters.href?no_esc}"<#rt/>
</#if>
+<#if parameters.disabled!false>
+ disabled="disabled"<#rt/>
+</#if>
<#if parameters.tabindex??>
tabindex="${parameters.tabindex}"<#rt/>
</#if>
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
index 7c3f80d71..9e45ed7a7 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
@@ -276,6 +276,23 @@ public class AnchorTest extends AbstractUITagTest {
verifyResource("href-5.txt");
}
+ public void testSimpleDisabled() throws Exception {
+ createAction();
+
+ AnchorTag tag = createTag();
+ tag.setHref("a");
+ tag.setDisabled("true");
+
+ StrutsBodyContent body = new StrutsBodyContent(null);
+ body.print("should have disabled attribute");
+ tag.setBodyContent(body);
+
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verifyResource("href-6.txt");
+ }
+
public void testInjectEscapeHtmlBodyFlag() throws Exception {
// given
initDispatcherWithConfigs("struts-default.xml, struts-escape-body.xml");
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-6.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-6.txt
new file mode 100644
index 000000000..1e75ca9aa
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-6.txt
@@ -0,0 +1 @@
+<a id="mylink" href="a" disabled="disabled">should have disabled attribute</a>
\ No newline at end of file