Author: konstantin.mishin
Date: 2009-03-04 11:59:50 -0500 (Wed, 04 Mar 2009)
New Revision: 12828
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxOutputPanel/ajaxOutputPanelAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JOutputPanelTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxOutputPanel/ajaxOutputPanelTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
Log:
RF-6195
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JOutputPanelTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JOutputPanelTestBean.java 2009-03-04
16:37:38 UTC (rev 12827)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JOutputPanelTestBean.java 2009-03-04
16:59:50 UTC (rev 12828)
@@ -20,6 +20,8 @@
*/
package org.ajax4jsf.bean;
+import javax.faces.component.UIComponent;
+
/**
* A4JOutputPanel Test Bean
* @author Alexandr Levkovsky
@@ -31,18 +33,28 @@
private Boolean ajaxRendered;
+ private Boolean keepTransient;
+
private String outputText;
+ private UIComponent binding;
+
public void init() {
layout = "inline";
ajaxRendered = false;
outputText = "text";
+ keepTransient = true;
+ binding = null;
}
public void submit() {
outputText = "changed";
}
+ public void setTransient() {
+ binding.setTransient(true);
+ }
+
public void setOutputText(String outputText) {
this.outputText = outputText;
}
@@ -66,4 +78,24 @@
public Boolean getAjaxRendered() {
return ajaxRendered;
}
+
+ public void setKeepTransient(Boolean keepTransient) {
+ this.keepTransient = keepTransient;
+ }
+
+ public Boolean getKeepTransient() {
+ return keepTransient;
+ }
+
+ public String getTransientState() {
+ return binding != null ? Boolean.toString(binding.isTransient()) : "";
+ }
+
+ public void setBinding(UIComponent binding) {
+ this.binding = binding;
+ }
+
+ public UIComponent getBinding() {
+ return binding;
+ }
}
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxOutputPanel/ajaxOutputPanelAutoTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxOutputPanel/ajaxOutputPanelAutoTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxOutputPanel/ajaxOutputPanelAutoTest.xhtml 2009-03-04
16:59:50 UTC (rev 12828)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <a4j:outputPanel id="componentId"
rendered="#{autoTestBean.rendered}"
+ style="width: 100%; color: yellow"
+ styleClass="noname"
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ >
+ <h:outputText value="text"></h:outputText>
+ </a4j:outputPanel>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxOutputPanel/ajaxOutputPanelTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java 2009-03-04
16:37:38 UTC (rev 12827)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java 2009-03-04
16:59:50 UTC (rev 12828)
@@ -20,7 +20,11 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -37,6 +41,8 @@
private String ajaxRendered;
+ private String keepTransient;
+
private String reset;
private String mainForm;
@@ -45,18 +51,25 @@
private String outputText;
+ private String transientState;
+
private String submit;
+ private String setTransient;
+
private void init(Template template) {
renderPage(null, template, "#{a4jOutputPanelBean.init}");
String attrForm = getParentId() + "attrForm";
layout = attrForm + ":layout";
ajaxRendered = attrForm + ":ajaxRendered";
+ keepTransient = attrForm + ":keepTransient";
reset = attrForm + ":reset";
mainForm = getParentId() + "mainForm";
outputPanel = mainForm + ":outputPanel";
outputText = mainForm + ":outputText";
+ transientState = mainForm + ":transientState";
submit = mainForm + ":submit";
+ setTransient = mainForm + ":setTransient";
}
/**
@@ -85,7 +98,41 @@
Assert.assertEquals(selenium.getText(outputText), "changed");
}
+ /**
+ * transient components are kept when keepTransient = true
+ */
@Test
+ public void testKeepTransient(Template template) {
+ init(template);
+ clickAjaxCommandAndWait(ajaxRendered);
+ Assert.assertEquals(selenium.getText(transientState), "false");
+ clickAjaxCommandAndWait(setTransient);
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getText(transientState), "false");
+ clickAjaxCommandAndWait(keepTransient);
+ Assert.assertEquals(selenium.getText(transientState), "false");
+ clickAjaxCommandAndWait(setTransient);
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getText(transientState), "true");
+ }
+
+ /**
+ * component with rendered = false is not present on the page,
+ * style and classes, standard HTML attributes are output to client
+ */
+ @Test
+ public void testStandardAttributes(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ autoTester.testRendered();
+ Map<String, String> styleAttributes = new HashMap<String, String>();
+ styleAttributes.put("width", "100%");
+ styleAttributes.put("color", "yellow");
+ autoTester.testStyleAndClasses(new String[]{"noname"}, styleAttributes);
+ autoTester.testHTMLEvents();
+ }
+
+ @Test
public void testLayoutAttribute(Template template) {
init(template);
Assert.assertEquals(selenium.getAttribute("xpath=id('" + mainForm +
"')/span/span/span@id"), outputText);
@@ -97,7 +144,12 @@
Assert.assertEquals(selenium.getAttribute("xpath=id('" + mainForm +
"')/span/span@id"), outputText);
}
- @Override
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/ajaxOutputPanel/ajaxOutputPanelAutoTest.xhtml";
+ }
+
+ @Override
public String getTestUrl() {
return "pages/ajaxOutputPanel/ajaxOutputPanelTest.xhtml";
}