Author: dsvyatobatsko
Date: 2008-10-03 11:55:25 -0400 (Fri, 03 Oct 2008)
New Revision: 10665
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxRegion/ajaxRegionTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java
Log:
AjaxRegion: test ajaxListener are invoked on each AJAX request
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java 2008-10-03
14:39:55 UTC (rev 10664)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java 2008-10-03
15:55:25 UTC (rev 10665)
@@ -1,5 +1,7 @@
package org.ajax4jsf.bean;
+import org.ajax4jsf.event.AjaxEvent;
+
public class A4JRegionTestBean {
private Integer internal = 0;
@@ -8,6 +10,10 @@
private Integer value = 0;
+ private boolean isInternalListenerInvoked;
+
+ private boolean isExternalListenerInvoked;
+
/**
* Gets value of internal field.
*
@@ -64,4 +70,44 @@
public void setValue(Integer value) {
this.value = value;
}
+
+ /**
+ * Gets value of isInternalListenerInvoked field.
+ * @return value of isInternalListenerInvoked field
+ */
+ public boolean isInternalListenerInvoked() {
+ return isInternalListenerInvoked;
+ }
+
+ /**
+ * Set a new value for isInternalListenerInvoked field.
+ * @param isInternalListenerInvoked a new value for isInternalListenerInvoked field
+ */
+ public void setInternalListenerInvoked(boolean isInternalListenerInvoked) {
+ this.isInternalListenerInvoked = isInternalListenerInvoked;
+ }
+
+ /**
+ * Gets value of isExternalListenerInvoked field.
+ * @return value of isExternalListenerInvoked field
+ */
+ public boolean isExternalListenerInvoked() {
+ return isExternalListenerInvoked;
+ }
+
+ /**
+ * Set a new value for isExternalListenerInvoked field.
+ * @param isExternalListenerInvoked a new value for isExternalListenerInvoked field
+ */
+ public void setExternalListenerInvoked(boolean isExternalListenerInvoked) {
+ this.isExternalListenerInvoked = isExternalListenerInvoked;
+ }
+
+ public void processOuterAjax(AjaxEvent event) {
+ setExternalListenerInvoked(true);
+ }
+
+ public void processInnerAjax(AjaxEvent event) {
+ setInternalListenerInvoked(true);
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxRegion/ajaxRegionTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java 2008-10-03
14:39:55 UTC (rev 10664)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java 2008-10-03
15:55:25 UTC (rev 10665)
@@ -61,6 +61,29 @@
AssertValueEquals(renderElemId, "11");
}
+ @Test
+ public void testAjaxListenerInvokedOnEachAJAXRequest(Template template) {
+ renderPage(template);
+
+ writeStatus("Check ajax listener is invoked on each AJAX request");
+
+ String parentId = getParentId() + "_form:";
+
+ String externalLink = parentId + "externalLink";
+ String internalLink = parentId + "internalLink";
+
+ String outerListener = parentId + "outerListener";
+ String innerListener = parentId + "innerListener";
+
+ clickAjaxCommandAndWait(internalLink);
+ AssertTextEquals(innerListener, "true", "AjaxListener for inner
region must have been invoked");
+ AssertTextEquals(outerListener, "false", "AjaxListener for outer
region mustn't have been invoked");
+
+ clickAjaxCommandAndWait(externalLink);
+ AssertTextEquals(innerListener, "true", "AjaxListener for inner
region must have been invoked");
+ AssertTextEquals(outerListener, "true", "AjaxListener for outer
region must have been invoked");
+ }
+
public String getTestUrl() {
return "pages/ajaxRegion/ajaxRegionTest.xhtml";
}
Show replies by date