[ 
https://issues.apache.org/jira/browse/WW-5117?focusedWorklogId=571664&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-571664
 ]

ASF GitHub Bot logged work on WW-5117:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Mar/21 05:55
            Start Date: 25/Mar/21 05:55
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart commented on a change in pull request #475:
URL: https://github.com/apache/struts/pull/475#discussion_r601072788



##########
File path: core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java
##########
@@ -62,6 +62,23 @@ public void testDisabled() throws Exception {
         verify(TextFieldTag.class.getResource("Hidden-2.txt"));
     }
 
+    public void testDynamicAttributes() throws Exception {
+        TestAction testAction = (TestAction) action;
+        testAction.setId(27357L);
+
+        HiddenTag tag = new HiddenTag();
+        tag.setPageContext(pageContext);
+        tag.setId("einszwei");
+        tag.setName("first");
+        tag.setValue("%{id}");
+        tag.setDynamicAttribute("", "data-wuffmiauww", "%{id}");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(TextFieldTag.class.getResource("Hidden-3.txt"));

Review comment:
       Not sure if I understand your question. Action is pushed on stack in 
`AbstractTagTest#createMocks` which happens on `setUp`, this isn't a full blown 
action execution loop, rather tag tests mimic the whole execution logic.
   Secondly, in `FreemarkerTemplateEngine` which is responisble for rendering 
tags (and takes part in the test logic) there is a check
   
   ```
   Object action = (ai == null) ? null : ai.getAction();
   ```
   
   and I have no idea if this was because of some possible solution or just to 
support testing - in normal situation `ActionInvocation` cannot be null and we 
are triggering an exception in such situation (not sure if this was already 
implemented in Struts 2.5.x).
   
   I was trying to re-configure this tag test to use proper action execution 
logic, but somehow I was ending up with two instances of the same action on the 
stack, after spending a few hours I gave up and added the above assertions.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 571664)
    Time Spent: 1.5h  (was: 1h 20m)

> %{id} evaluates different for data-* and value attribute
> --------------------------------------------------------
>
>                 Key: WW-5117
>                 URL: https://issues.apache.org/jira/browse/WW-5117
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.5.26
>            Reporter: Jonas Marczona
>            Priority: Major
>             Fix For: 2.5.27
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> {{%\{id\}}} evaluates for "data-*" attributes in a different way than for the 
> "value" attribute. 
> in a very simple context where I have only one getter:
> {code}
> public Long getId() {
>    return 27357L;
> }
> {code}
> The following two usages of "id" in one tag in a jsp evaluates in different 
> ways:
> JSP:
> {noformat}
> <%@ taglib prefix="s" uri="/struts-tags"%>
> <s:hidden name="first" data-wuffmiauww="%{id}" id="einszwei" value="%{id}"/>
> <s:hidden name="second" data-wuffmiauww="%{id}" value="%{id}"/>
> {noformat}
> Result:
> {noformat}
> <input type="hidden" name="first" value="27357" id="einszwei" 
> data-wuffmiauww="einszwei">
> <input type="hidden" name="second" value="27357" data-wuffmiauww>
> {noformat}
> I expect the Id of my getter - for both cases. 
> The value for {{data-wuffmiauww}} is wrong.
> With struts2 version 2.5.20 the result was correct:
> {noformat}
> <input type="hidden" name="first" value="27357" id="einszwei" 
> data-wuffmiauww="27357">
> <input type="hidden" name="second" value="27357" data-wuffmiauww="27357">
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to