Author: konstantin.mishin
Date: 2010-04-16 11:39:25 -0400 (Fri, 16 Apr 2010)
New Revision: 16768
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml
Log:
RF-7852
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-04-16
14:13:24 UTC (rev 16767)
+++
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-04-16
15:39:25 UTC (rev 16768)
@@ -5,10 +5,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
+import java.util.Map;
import javax.faces.application.ViewHandler;
import javax.faces.context.FacesContext;
@@ -174,4 +176,57 @@
// TODO fail("Not yet implemented");
}
+ @Test
+ public final void testFilteringWithoutClean() throws IOException {
+ FacesRequest facesRequest =
environment.createFacesRequest("http://localhost/extendedDataTableTest.jsf");
+ facesRequest.withViewId("/extendedDataTableTest.jsf");
+ facesRequest.start();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ViewHandler vh = facesContext.getApplication().getViewHandler();
+ ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext,
facesContext.getViewRoot()
+ .getViewId());
+ vdl.buildView(facesContext, facesContext.getViewRoot());
+ UIExtendedDataTable component = (UIExtendedDataTable)
facesContext.getViewRoot().findComponent("table");
+ ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer)
FacesContext.getCurrentInstance()
+ .getRenderKit().getRenderer(component.getFamily(),
component.getRendererType());
+ Map<String, Object> column1Attributes =
component.findComponent("column1").getAttributes();
+ Map<String, Object> column2Attributes =
component.findComponent("column2").getAttributes();
+ String clientId = component.getClientId(facesContext);
+ assertNull(column1Attributes.get("filterValue"));
+ assertEquals("filterValue2",
column2Attributes.get("filterValue"));
+ facesRequest.withParameter(clientId, clientId);
+ facesRequest.withParameter("rich:filterString",
"column1:filterValue1:null");
+ renderer.doDecode(facesContext, component);
+ assertEquals("filterValue1",
column1Attributes.get("filterValue"));
+ assertEquals("filterValue2",
column2Attributes.get("filterValue"));
+
assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
+ facesRequest.release();
+ }
+
+ @Test
+ public final void testFilteringWithClean() throws IOException {
+ FacesRequest facesRequest =
environment.createFacesRequest("http://localhost/extendedDataTableTest.jsf");
+ facesRequest.withViewId("/extendedDataTableTest.jsf");
+ facesRequest.start();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ViewHandler vh = facesContext.getApplication().getViewHandler();
+ ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext,
facesContext.getViewRoot()
+ .getViewId());
+ vdl.buildView(facesContext, facesContext.getViewRoot());
+ UIExtendedDataTable component = (UIExtendedDataTable)
facesContext.getViewRoot().findComponent("table");
+ ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer)
FacesContext.getCurrentInstance()
+ .getRenderKit().getRenderer(component.getFamily(),
component.getRendererType());
+ Map<String, Object> column1Attributes =
component.findComponent("column1").getAttributes();
+ Map<String, Object> column2Attributes =
component.findComponent("column2").getAttributes();
+ String clientId = component.getClientId(facesContext);
+ assertNull(column1Attributes.get("filterValue"));
+ assertEquals("filterValue2",
column2Attributes.get("filterValue"));
+ facesRequest.withParameter(clientId, clientId);
+ facesRequest.withParameter("rich:filterString",
"column1:filterValue1:true");
+ renderer.doDecode(facesContext, component);
+ assertEquals("filterValue1",
column1Attributes.get("filterValue"));
+ assertNull(column2Attributes.get("filterValue"));
+
assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
+ facesRequest.release();
+ }
}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml 2010-04-16
14:13:24 UTC (rev 16767)
+++
root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml 2010-04-16
15:39:25 UTC (rev 16768)
@@ -54,7 +54,7 @@
<h:outputText id="footerColumnFacet1"
value="footerColumnFacet1"/>
</f:facet>
</rich:column>
- <rich:column id="column2" >
+ <rich:column id="column2" filterValue="filterValue2">
<f:facet name="header">
<h:outputText id="headerColumnFacet2"
value="headerColumnFacet2"/>
</f:facet>
Show replies by date