0
votes

I am using the treeview for two things:

1.) Click of an list-item in the treeview opens a new page with the children populated. 2.) Expand or collapse of the treeview using the setting, "persist: 'cookie'", since I need to know the collapsed list times done in step 1.

For testing, I need to write two test cases in Java for expand and collapse. Is there any way to get the id of the href of expand(+) or collapse(-) icon. So that I can get the id and call the click on that element.

Thanks in advance.

2

2 Answers

1
votes

Under each li, there is a empty div which captures the click event for "+/-" in the treeview. When the li expanded(-), the code looks like:

<li class="collapsable lastCollapsable">
  <div class="hitarea collapsable-hitarea lastCollapsable-hitarea " id="unique_id"></div>

And when the li is collapsed(+), the code looks like:

<li class="expandable lastExpandable">
  <div class="hitarea expandable-hitarea lastExpandable-hitarea" id="unique_id"> 

So, from javascript or any other test case, we can use getElementById("unique_id").click(). We may need to add a unique id for each li.

-1
votes
dijit.byId("tree")._expandNode(dijit.byId('tree').get('selectedNode'))