Create Fragment.getAssociatedMarkupId
-------------------------------------

                 Key: WICKET-3966
                 URL: https://issues.apache.org/jira/browse/WICKET-3966
             Project: Wicket
          Issue Type: New Feature
          Components: wicket-core
    Affects Versions: 1.4.17
            Reporter: Eduardo Costa


Class org.apache.wicket.markup.html.panel.Fragment has two attributes: 
"associated markupId" and "markupProvider". One can reach "markupProvider" with 
"getMarkupProvider", but there's no way to reach "markupId" (not even extending 
Fragment, since the attribute is private). IMHO, two actions must be taken:

1. rename this attribute to "associatedMarkupId", to prevent name clash from 
parent's "getMarkupId";
2. create a "getAssociatedMarkupId"

This is a must have for unit testing. Consider a classic "view/edit" pair of 
fragments (where "view" appears for guests and "edit" for admins). I could test 
if "view" is activated as simple as:

    tester.assertComponent("panel:grid", Fragment.class);
    assertEquals("view", ((Fragment) 
tester.getComponentFromLastRenderedPage("panel:grid")).getAssociatedMarkupId());

Unfortunatelly, there's no way to get the associated markup id. This means this 
behavior is untestable!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to