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]


Reply via email to