test rich:tree click
hiroorih Aug 28, 2009 8:51 AMhello,
i've two trees in my page.
one is for profiles and the other one for views.
if i select a profile than the view tree is rerendered.
<body> <richfaces:panel id="searchTreePanelId" styleClass="leftBox"> <a4j:outputPanel id="profileTreeOutputPanelId"> <h:form id="profileTreeFormId"> <richfaces:tree id="profileTreeId" nodeSelectListener="#{Search.profileTreeSelection}" ajaxSubmitSelection="true" switchType="client" reRender="viewTreeOutputPanelId" value="#{Search.profileTreeNode}" var="item"> </richfaces:tree> </h:form> </a4j:outputPanel> <a4j:outputPanel id="viewTreeOutputPanelId"> <h:form id="viewTreeFormId"> <richfaces:tree id="viewTreeId" nodeSelectListener="#{Search.viewTreeSelection}" ajaxSubmitSelection="true" switchType="client" reRender="searchMask" value="#{Search.viewTreeNode}" var="item"> </richfaces:tree> </h:form> </a4j:outputPanel> </richfaces:panel> </body>
the profile tree rerenders the view tree iff a leaf is selected.
public void profileTreeSelection(NodeSelectedEvent event) { HtmlTree tree = (HtmlTree) event.getComponent(); TreeNodeImpl currentNode = (TreeNodeImpl) tree.getModelTreeNode(tree.getRowKey()); if (currentNode.isLeaf()){ // call Web Service List<View> views = ... // create view tree rootViewNode = new TreeNodeImpl(); TreeNode newViewNode = new TreeNodeImpl(); newViewNode.setData(mf.getMessage("search.tree.rootView.view")); newViewNode.addChild(new Integer(1), new TreeNodeImpl()); rootViewNode.addChild(new Integer(1), newViewNode); int counter = 1; // Hinzufügen der Views von Web Service for(View viewInfo : views){ TreeNodeImpl newChildNode = new TreeNodeImpl(); newChildNode.setData(viewInfo); newViewNode.addChild(new Integer(counter++), newChildNode); } } }
my problem is now, how can i simulate a click on a leaf via jsfunit?
i already tried a lot of things:
* richFacesClient.clickTreeNodeHandle(...) -> no component Id found
* client.getElement(...).click() -> nothing happended
* client.getElement(...).fireEvent(Event.TYPE_SUBMIT/FOCUS/CHANGE) -> nothing happended
* ...
for now i'm quite uninspired ... ,-|
may you have any ideas?
thanks
hiro