Author: konstantin.mishin
Date: 2009-01-16 14:12:25 -0500 (Fri, 16 Jan 2009)
New Revision: 12318
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-5583
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-16
16:47:48 UTC (rev 12317)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java 2009-01-16
19:12:25 UTC (rev 12318)
@@ -48,21 +48,27 @@
private List<Node> nodes;
private String trace;
+ private Boolean ajaxSingle;
public TreeNodesAdaptorTestBean() {
init();
}
public void init() {
- trace = "";
nodes = new ArrayList<Node>(3);
for (int i = 1; i <= 3; i++) {
Node node = new Node(Integer.toString(i));
nodes.add(node);
for (int j = 1; j <= 3; j++) {
- node.addChild(new Node(Integer.toString(i * 10 + j)));
+ Node node2 = new Node(Integer.toString(i * 10 + j));
+ node.addChild(node2);
+ for (int k = 1; k <= 3; k++) {
+ node2.addChild(new Node(Integer.toString(i * 100 + j * 10 + k)));
+ }
}
}
+ trace = "";
+ ajaxSingle = false;
}
public void submit(ActionEvent event) {
@@ -84,4 +90,12 @@
public List<Node> getNodes() {
return nodes;
}
+
+ public void setAjaxSingle(Boolean ajaxSingle) {
+ this.ajaxSingle = ajaxSingle;
+ }
+
+ public Boolean getAjaxSingle() {
+ return ajaxSingle;
+ }
}
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-16
16:47:48 UTC (rev 12317)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml 2009-01-16
19:12:25 UTC (rev 12318)
@@ -8,29 +8,42 @@
<ui:composition template="#{templateBean.template}">
<ui:define name="component">
+ <h:form id="attrForm">
+ <h:outputText value="ajaxSingle" />
+ <h:selectBooleanCheckbox id="ajaxSingle"
value="#{treeNodesAdaptor.ajaxSingle}">
+ <a4j:support event="onchange" reRender="tree"/>
+ </h:selectBooleanCheckbox>
+ </h:form>
<h:form id="mainForm">
<rich:tree id="tree">
<rich:treeNodesAdaptor nodes="#{treeNodesAdaptor.nodes}"
var="node">
<rich:treeNode>
<h:outputText value="#{node.id}"></h:outputText>
<h:commandButton id="submit" value="submit"
actionListener="#{treeNodesAdaptor.submit}"></h:commandButton>
- <a4j:commandButton id="ajaxSubmit" value="ajaxSubmit"
reRender="outputText, dataTable"
actionListener="#{treeNodesAdaptor.submit}"></a4j:commandButton>
- <a4j:commandButton id="ajaxSingleSubmit"
value="ajaxSingleSubmit" reRender="outputText, dataTable"
actionListener="#{treeNodesAdaptor.submit}"
ajaxSingle="true"></a4j:commandButton>
+ <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:treeNode>
+ <rich:treeNode ajaxSingle="#{treeNodesAdaptor.ajaxSingle}">
<h:inputText value="#{child.id}"></h:inputText>
</rich:treeNode>
+ <rich:treeNodesAdaptor nodes="#{child.children}"
var="child2">
+ <rich:treeNode>
+ <h:outputText value="#{child2.id}"></h:outputText>
+ </rich:treeNode>
+ </rich:treeNodesAdaptor>
</rich:treeNodesAdaptor>
</rich:treeNodesAdaptor>
</rich:tree>
</h:form>
- <h:outputText id="outputText"
value="#{treeNodesAdaptor.trace}"></h:outputText>
- <h:dataTable id="dataTable"
value="#{treeNodesAdaptor.nodes[1].children}" var="child">
- <h:column>
- <h:outputText value="#{child.id}"></h:outputText>
- </h:column>
- </h:dataTable>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:outputText id="outputText"
value="#{treeNodesAdaptor.trace}"></h:outputText>
+ <h:dataTable id="dataTable"
value="#{treeNodesAdaptor.nodes[1].children}" var="child">
+ <h:column>
+ <h:outputText value="#{child.id}"></h:outputText>
+ </h:column>
+ </h:dataTable>
+ </a4j:outputPanel>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
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-16
16:47:48 UTC (rev 12317)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java 2009-01-16
19:12:25 UTC (rev 12318)
@@ -34,6 +34,8 @@
private List<Node> nodes;
+ private String ajaxSingle;
+
private String tree;
private String outputText;
@@ -45,9 +47,15 @@
Node node = new Node(Integer.toString(i));
nodes.add(node);
for (int j = 1; j <= 3; j++) {
- node.addChild(new Node(Integer.toString(i * 10 + j)));
+ Node node2 = new Node(Integer.toString(i * 10 + j));
+ node.addChild(node2);
+ for (int k = 1; k <= 3; k++) {
+ node2.addChild(new Node(Integer.toString(i * 100 + j * 10 + k)));
+ }
}
}
+ String attrForm = getParentId() + "attrForm";
+ ajaxSingle = attrForm + ":ajaxSingle";
String mainForm = getParentId() + "mainForm";
tree = mainForm + ":tree";
outputText = getParentId() + "outputText";
@@ -75,15 +83,19 @@
}
}
- private void checkModel(String nodesLocator) {
+ private void checkModel(String nodesLocator, boolean ajaxSingle) {
String dataTableLocator = "xpath=id('"+ dataTable +
"')/tbody/tr[";
for (int j = 1; j <= 3; j++) {
- Assert.assertEquals(selenium.getValue(nodesLocator + "/table[" + j +
"]/tbody/tr/td[3]/input"), selenium.getText(dataTableLocator + j +
"]"));
- }
+ 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 +
"]"));
+ }
+ }
}
/**
- * check input and command components processing
+ * check input and command components processing with ajaxSingle nodes
*/
@Test
public void testComponentsProcessing(Template template) {
@@ -92,15 +104,22 @@
String titleLocator = locator + "/table[2]/tbody/tr";
clickAjaxCommandAndWait(titleLocator + "/td[1]/div/a");
String nodesLocator = locator + "/div[2]";
- checkModel(nodesLocator);
+ checkModel(nodesLocator, false);
for (int j = 1; j <= 3; j++) {
selenium.type(nodesLocator + "/table[" + j +
"]/tbody/tr/td[3]/input", "abc" + j);
}
+ clickAjaxCommandAndWait(nodesLocator + "/table[1]/tbody/tr/td[1]/div/a");
+ checkModel(nodesLocator, false);
+ clickAjaxCommandAndWait(ajaxSingle);
+ 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");
+ checkModel(nodesLocator, true);
String buttonLocator = titleLocator + "/td[3]/input[";
Assert.assertEquals(selenium.getText(outputText), "");
selenium.click(buttonLocator + "1]");
waitForPageToLoad();
- checkModel(nodesLocator);
Assert.assertTrue(selenium.getText(outputText).endsWith("1::submit"));
selenium.click(buttonLocator + "2]");
waitForAjaxCompletion();
Show replies by date