Author: konstantin.mishin
Date: 2009-02-11 06:30:52 -0500 (Wed, 11 Feb 2009)
New Revision: 12628
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/validation/ValidationBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxValidator/ajaxValidatorTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxValidatorTest.java
Log:
RF-5995 RF-5996
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/validation/ValidationBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/validation/ValidationBean.java 2009-02-11
11:11:18 UTC (rev 12627)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/validation/ValidationBean.java 2009-02-11
11:30:52 UTC (rev 12628)
@@ -29,6 +29,10 @@
*/
public class ValidationBean {
+ public void init() {
+ this.rendered = true;
+ }
+
static final String INPUT_TEXT = "text";
public static final String STATUS_TEXT = "UPDATE_MODEL";
@@ -38,6 +42,8 @@
private String status;
private User user = new User();
+
+ private Boolean rendered;
public User getUser() {
return user;
@@ -108,4 +114,12 @@
public void setStatus(String status) {
this.status = status;
}
+
+ public void setRendered(Boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public Boolean getRendered() {
+ return rendered;
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-11
11:11:18 UTC (rev 12627)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-11
11:30:52 UTC (rev 12628)
@@ -286,7 +286,7 @@
<managed-bean>
<managed-bean-name>validationBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.validation.ValidationBean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>dndBean</managed-bean-name>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxValidator/ajaxValidatorTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxValidatorTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxValidatorTest.java 2009-02-11
11:11:18 UTC (rev 12627)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxValidatorTest.java 2009-02-11
11:30:52 UTC (rev 12628)
@@ -20,6 +20,8 @@
*/
package org.richfaces.testng;
+import junit.framework.Assert;
+
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
@@ -34,9 +36,11 @@
private static final String ERR_MSG_POSTFIX = "_err_msg";
+ private static final String RESET_METHOD = "#{validationBean.init}";
+
@Test
public void testAjaxValidatorComponentWithStandartValidators(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD);
writeStatus("Check ajax validator component with standart validators.
"
+ "Validation has to be occured by javascript event
'onblur'");
@@ -58,8 +62,7 @@
assertPresent(tfNameErrMsg);
writeStatus("Age must be greater than or equal to 18. Type less than
that");
- type(tfAgeId, "3");
- selenium.fireEvent(tfAgeId, "blur");
+ selenium.type(tfAgeId, "3");
waitForAjaxCompletion();
assertPresent(tfAgeErrMsg);
@@ -70,16 +73,32 @@
waitForAjaxCompletion();
assertNotPresent(tfNameErrMsg);
- type(tfAgeId, "33");
- selenium.fireEvent(tfAgeId, "blur");
+ selenium.type(tfAgeId, "33");
waitForAjaxCompletion();
assertNotPresent(tfAgeErrMsg);
}
@Test
+ public void testRendered(Template template) {
+ renderPage(template, RESET_METHOD);
+
+ String rendered = getParentId() + "attrForm" + ":rendered";
+ String tfNameId = getParentId() + "_form:" + NAME;
+ String tfNameErrMsg = tfNameId + ERR_MSG_POSTFIX;
+ type(tfNameId, "Mi");
+ selenium.fireEvent(tfNameId, "blur");
+ waitForAjaxCompletion();
+ assertPresent(tfNameErrMsg);
+ clickAjaxCommandAndWait(rendered);
+ type(tfNameId, "Mi");
+ selenium.fireEvent(tfNameId, "blur");
+ assertNotPresent(tfNameErrMsg);
+ }
+
+ @Test
public void testAjaxValidatorComponentWithHibernateValidator(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD);
writeStatus("Check ajax validator component with hibernate validator.
"
+ "Validation has to be occured by javascript event
'onblur'");
Show replies by date