Author: konstantin.mishin
Date: 2009-01-19 14:00:16 -0500 (Mon, 19 Jan 2009)
New Revision: 12343
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java
Log:
RF-5584
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java 2009-01-19
18:59:33 UTC (rev 12342)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java 2009-01-19
19:00:16 UTC (rev 12343)
@@ -49,6 +49,7 @@
private List<Node> nodes;
private String trace;
private Boolean ajaxSingle;
+ private Boolean includedNode;
public TreeNodesAdaptorTestBean() {
init();
@@ -69,6 +70,7 @@
}
trace = "";
ajaxSingle = false;
+ includedNode = true;
}
public void submit(ActionEvent event) {
@@ -98,4 +100,12 @@
public Boolean getAjaxSingle() {
return ajaxSingle;
}
+
+ public void setIncludedNode(Boolean includedNode) {
+ this.includedNode = includedNode;
+ }
+
+ public Boolean getIncludedNode() {
+ return includedNode;
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml 2009-01-19
18:59:33 UTC (rev 12342)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml 2009-01-19
19:00:16 UTC (rev 12343)
@@ -13,6 +13,10 @@
<h:selectBooleanCheckbox id="ajaxSingle"
value="#{treeNodesAdaptor.ajaxSingle}">
<a4j:support event="onchange" reRender="tree"/>
</h:selectBooleanCheckbox>
+ <h:outputText value="includedNode" />
+ <h:selectBooleanCheckbox id="includedNode"
value="#{treeNodesAdaptor.includedNode}">
+ <a4j:support event="onchange" reRender="tree"/>
+ </h:selectBooleanCheckbox>
</h:form>
<h:form id="mainForm">
<rich:tree id="tree">
@@ -23,7 +27,7 @@
<a4j:commandButton id="ajaxSubmit" value="ajaxSubmit"
actionListener="#{treeNodesAdaptor.submit}"></a4j:commandButton>
<a4j:commandButton id="ajaxSingleSubmit"
value="ajaxSingleSubmit" actionListener="#{treeNodesAdaptor.submit}"
ajaxSingle="true"></a4j:commandButton>
</rich:treeNode>
- <rich:treeNodesAdaptor nodes="#{node.children}"
var="child">
+ <rich:treeNodesAdaptor nodes="#{node.children}" var="child"
includedNode="#{treeNodesAdaptor.includedNode}">
<rich:treeNode ajaxSingle="#{treeNodesAdaptor.ajaxSingle}">
<h:inputText value="#{child.id}"></h:inputText>
</rich:treeNode>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java 2009-01-19
18:59:33 UTC (rev 12342)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java 2009-01-19
19:00:16 UTC (rev 12343)
@@ -36,6 +36,8 @@
private String ajaxSingle;
+ private String includedNode;
+
private String tree;
private String outputText;
@@ -56,6 +58,7 @@
}
String attrForm = getParentId() + "attrForm";
ajaxSingle = attrForm + ":ajaxSingle";
+ includedNode = attrForm + ":includedNode";
String mainForm = getParentId() + "mainForm";
tree = mainForm + ":tree";
outputText = getParentId() + "outputText";
@@ -86,7 +89,7 @@
private void checkModel(String nodesLocator, boolean ajaxSingle) {
String dataTableLocator = "xpath=id('"+ dataTable +
"')/tbody/tr[";
for (int j = 1; j <= 3; j++) {
- if (ajaxSingle && j == 2) {
+ if (ajaxSingle && j != 2) {
Assert.assertFalse(selenium.getValue(nodesLocator + "/table[" + j +
"]/tbody/tr/td[3]/input").equals(selenium.getText(dataTableLocator + j +
"]")));
} else {
Assert.assertEquals(selenium.getValue(nodesLocator + "/table[" + j +
"]/tbody/tr/td[3]/input"), selenium.getText(dataTableLocator + j +
"]"));
@@ -114,7 +117,7 @@
for (int j = 1; j <= 3; j++) {
selenium.type(nodesLocator + "/table[" + j +
"]/tbody/tr/td[3]/input", "xyz" + j);
}
- clickAjaxCommandAndWait(nodesLocator + "/table[1]/tbody/tr/td[1]/div/a");
+ clickAjaxCommandAndWait(nodesLocator + "/table[2]/tbody/tr/td[1]/div/a");
checkModel(nodesLocator, true);
String buttonLocator = titleLocator + "/td[3]/input[";
Assert.assertEquals(selenium.getText(outputText), "");
@@ -129,6 +132,20 @@
Assert.assertTrue(selenium.getText(outputText).endsWith("1::ajaxSingleSubmit"));
}
+ /**
+ * includedNode expression is handled properly
+ */
+ @Test
+ public void testIncludedNode(Template template) {
+ init(template);
+ String xpath = "id('"+ tree + "')/div";
+ clickAjaxCommandAndWait("xpath=" + xpath +
"/table[2]/tbody/tr/td[1]/div/a");
+ String childrenXpath = "id('"+ tree + "')/div" +
"/div[2]/table";
+ Assert.assertEquals(selenium.getXpathCount(childrenXpath),
nodes.get(1).getChildren().size());
+ clickAjaxCommandAndWait(includedNode);
+ Assert.assertEquals(selenium.getXpathCount(childrenXpath), 0);
+ }
+
@Override
public String getTestUrl() {
return "pages/treeNodesAdaptor/treeNodesAdaptor.xhtml";
Show replies by date