Author: konstantin.mishin
Date: 2009-01-27 09:15:24 -0500 (Tue, 27 Jan 2009)
New Revision: 12436
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataGridBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataGrid/dataGrid.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataGridTest.java
Log:
RF-5676
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataGridBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataGridBean.java 2009-01-27
13:36:43 UTC (rev 12435)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataGridBean.java 2009-01-27
14:15:24 UTC (rev 12436)
@@ -3,6 +3,9 @@
import java.util.ArrayList;
import java.util.List;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
public class DataGridBean {
public class Element {
@@ -44,17 +47,23 @@
private List<Element> model;
private int elements;
+ private String trace;
public DataGridBean() {
+ init();
+ }
+
+ public void init() {
model = new ArrayList<Element>(10);
for (int i = 0; i < 10; i++) {
model.add(new Element(Integer.toString(i)));
}
- init();
+ elements = 0;
+ trace = "";
}
- public void init() {
- elements = 0;
+ public void submit(ActionEvent event) {
+ trace = event.getComponent().getClientId(FacesContext.getCurrentInstance());
}
public void setModel(List<Element> model) {
@@ -72,4 +81,12 @@
public int getElements() {
return elements;
}
+
+ public void setTrace(String trace) {
+ this.trace = trace;
+ }
+
+ public String getTrace() {
+ return trace;
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataGrid/dataGrid.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataGrid/dataGrid.xhtml 2009-01-27
13:36:43 UTC (rev 12435)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataGrid/dataGrid.xhtml 2009-01-27
14:15:24 UTC (rev 12436)
@@ -23,16 +23,19 @@
</h:selectBooleanCheckbox-->
</h:form>
<h:form id="mainForm">
- <rich:dataGrid id="dataGrid" value="#{dataGrid.model}"
var="row" elements="#{dataGrid.elements}">
+ <rich:dataGrid id="dataGrid" value="#{dataGrid.model}"
var="element" elements="#{dataGrid.elements}">
<h:panelGroup>
- <h:outputText value="#{row.cell1}"></h:outputText>
- <h:inputText value="#{row.cell2}"></h:inputText>
- <h:outputText value="#{row.cell3}"></h:outputText>
+ <h:outputText value="#{element.cell1}"></h:outputText>
+ <h:inputText value="#{element.cell2}"></h:inputText>
+ <h:outputText value="#{element.cell3}"></h:outputText>
+ <h:commandButton id="submit" value="submit"
actionListener="#{dataGrid.submit}"></h:commandButton>
+ <a4j:commandButton id="ajaxSubmit" value="ajaxSubmit"
actionListener="#{dataGrid.submit}"></a4j:commandButton>
+ <a4j:commandButton id="ajaxSingleSubmit"
value="ajaxSingleSubmit" actionListener="#{dataGrid.submit}"
ajaxSingle="true"></a4j:commandButton>
</h:panelGroup>
</rich:dataGrid>
</h:form>
<a4j:outputPanel ajaxRendered="true">
- <h:outputText id="outputText"
value="#{treeNodesAdaptor.trace}"></h:outputText>
+ <h:outputText id="outputText"
value="#{dataGrid.trace}"></h:outputText>
<h:dataTable id="dataTable" value="#{dataGrid.model}"
var="row" rows="#{dataGrid.elements}">
<h:column>
<h:outputText value="#{row.cell2}"></h:outputText>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataGridTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataGridTest.java 2009-01-27
13:36:43 UTC (rev 12435)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataGridTest.java 2009-01-27
14:15:24 UTC (rev 12436)
@@ -27,7 +27,7 @@
/**
* items from collection defined as value attribute are output to the client;
- * number of items is limited using rows attribute and not
+ * number of items is limited using elements attribute and not
*/
@Test
public void testStructure(Template template) {
@@ -39,6 +39,30 @@
chekStructure();
}
+ /**
+ * nested input and command components work correctly
+ */
+ @Test
+ public void testComponentsProcessing(Template template) {
+ init(template);
+ String trLocator = "xpath=id('"+ dataGrid +
"')/tbody/tr[";
+ String inputLocator = trLocator + "6]/td/input[";
+ Assert.assertEquals(selenium.getText(outputText), "");
+ selenium.click(inputLocator + "2]");
+ waitForPageToLoad();
+ Assert.assertTrue(selenium.getText(outputText).endsWith("5:submit"));
+ selenium.click(inputLocator + "3]");
+ waitForAjaxCompletion();
+ Assert.assertTrue(selenium.getText(outputText).endsWith("5:ajaxSubmit"));
+ selenium.click(inputLocator + "4]");
+ waitForAjaxCompletion();
+ Assert.assertTrue(selenium.getText(outputText).endsWith("5:ajaxSingleSubmit"));
+ selenium.type(inputLocator + "1]", "abc5");
+ selenium.click(inputLocator + "3]");
+ waitForAjaxCompletion();
+ chekStructure();
+ }
+
private void chekStructure() {
String dataTableRowLocator = "id('"+ dataTable +
"')/tbody/tr";
int count = selenium.getXpathCount(dataTableRowLocator).intValue();