Author: konstantin.mishin
Date: 2009-01-30 13:01:09 -0500 (Fri, 30 Jan 2009)
New Revision: 12509
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-5682
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-30
17:54:05 UTC (rev 12508)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataGridBean.java 2009-01-30
18:01:09 UTC (rev 12509)
@@ -8,6 +8,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
import javax.faces.event.ActionEvent;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
@@ -133,4 +134,20 @@
public Boolean getRendered() {
return rendered;
}
+
+ public Converter getRowKeyConverter() {
+ return new Converter(){
+
+ public Object getAsObject(FacesContext context,
+ UIComponent component, String value) {
+ return new Integer(value.substring(2));
+ }
+
+ public String getAsString(FacesContext context,
+ UIComponent component, Object value) {
+ return "c_" + value.toString();
+ }
+
+ };
+ }
}
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-30
17:54:05 UTC (rev 12508)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataGrid/dataGrid.xhtml 2009-01-30
18:01:09 UTC (rev 12509)
@@ -24,7 +24,8 @@
elements="#{dataGrid.elements}" ajaxKeys="#{dataGrid.ajaxKeys}"
stateVar="stateVar" rowKeyVar="rowKeyVar"
componentState="#{componentState}"
- rendered="#{dataGrid.rendered}">
+ rendered="#{dataGrid.rendered}"
+ rowKeyConverter="#{dataGrid.rowKeyConverter}">
<h:panelGroup>
<h:outputText id="rowKeyVar" value="#{rowKeyVar}
"></h:outputText>
<h:outputText id="first" value="#{stateVar.range.firstRow}
"></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-30
17:54:05 UTC (rev 12508)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataGridTest.java 2009-01-30
18:01:09 UTC (rev 12509)
@@ -97,11 +97,11 @@
@Test
public void testVars(Template template) {
init(template);
- Assert.assertEquals(selenium.getText(dataGrid + ":2:first"), "0",
"Attribute 'stateVar' works wrong.");
- Assert.assertEquals(selenium.getText(dataGrid + ":2:rows"), "0",
"Attribute 'stateVar' works wrong.");
+ Assert.assertEquals(selenium.getText(dataGrid + ":c_2:first"), "0",
"Attribute 'stateVar' works wrong.");
+ Assert.assertEquals(selenium.getText(dataGrid + ":c_2:rows"), "0",
"Attribute 'stateVar' works wrong.");
int rows = selenium.getXpathCount("id('"+ dataGrid +
"')/tbody/tr").intValue();
for (int i = 0; i < rows; i++) {
- Assert.assertEquals(selenium.getText(dataGrid + ":" + i +
":rowKeyVar"), Integer.toString(i));
+ Assert.assertEquals(selenium.getText(dataGrid + ":c_" + i +
":rowKeyVar"), Integer.toString(i));
}
}
@@ -111,8 +111,8 @@
@Test
public void testComponentState(Template template) {
init(template);
- Assert.assertEquals(selenium.getText(dataGrid + ":2:firstState"),
"0", "Attribute 'componentState' works wrong.");
- Assert.assertEquals(selenium.getText(dataGrid + ":2:rowsState"),
"0", "Attribute 'componentState' works wrong.");
+ Assert.assertEquals(selenium.getText(dataGrid + ":c_2:firstState"),
"0", "Attribute 'componentState' works wrong.");
+ Assert.assertEquals(selenium.getText(dataGrid + ":c_2:rowsState"),
"0", "Attribute 'componentState' works wrong.");
}
/**
@@ -140,6 +140,15 @@
autoTester.testHTMLEvents();
}
+ /**
+ * rowKeyConverter outputs correct client ids
+ */
+ @Test
+ public void testRowKeyConverter(Template template) {
+ init(template);
+ Assert.assertTrue(selenium.getAttribute("xpath=id('"+ dataGrid +
"')/tbody/tr[3]/td@id").endsWith(":c_2"), "Attribute
'rowKeyConverter' works wrong.");
+ }
+
private void chekStructure(int ... notEqualRows) {
String dataTableRowLocator = "id('"+ dataTable +
"')/tbody/tr";
int count = selenium.getXpathCount(dataTableRowLocator).intValue();
Show replies by date