Author: vmolotkov
Date: 2008-11-05 13:28:56 -0500 (Wed, 05 Nov 2008)
New Revision: 11035
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testStandartAttributes.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValidator.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
Log:
tests for inplaceinput
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testStandartAttributes.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testStandartAttributes.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testStandartAttributes.xhtml 2008-11-05
18:28:56 UTC (rev 11035)
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+ template="../../template/caseTemplate.xhtml">
+ <ui:define name="caseName">testStandartAttributes</ui:define>
+ <ui:define name="caseBody">
+ <style>
+ .classForInplaceinput {
+ color: red;
+ }
+ </style>
+ <h:form id="_form">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <rich:inplaceInput id="ii_tsa" value="test"
style="border: 3px"
+ styleClass="classForInplaceinput"
+ onclick="EventQueue.fire('onclick')"
+ ondblclick="EventQueue.fire('ondblclick')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onmouseup="EventQueue.fire('onmouseup')">
+ </rich:inplaceInput>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </h:form>
+ </ui:define>
+</ui:composition>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValidator.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValidator.xhtml 2008-11-05
18:04:06 UTC (rev 11034)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValidator.xhtml 2008-11-05
18:28:56 UTC (rev 11035)
@@ -6,16 +6,17 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="../../template/caseTemplate.xhtml">
- <ui:define name="caseName">testControlsFacet</ui:define>
+ <ui:define name="caseName">testValidator</ui:define>
<ui:define name="caseBody">
<h:form id="_form">
+ <h:panelGroup id="group_tv2">
<table cellpadding="5" >
<tr>
<td>1</td>
<td>
<rich:inplaceInput id="ii_tv1" value="test"
validator="#{inplaceInputBean.validator}">
</rich:inplaceInput>
- <h:commandButton id="bn_tv1"
action="#{inplaceInputBean.action}"
value="Submit"></h:commandButton>
+ <a4j:commandButton id="bn_tv1" reRender="group_tv2"
value="Submit"/>
</td>
<td><span id="text_tv1"><h:message
for="ii_tv1"/></span></td>
</tr>
@@ -25,11 +26,12 @@
<rich:inplaceInput id="ii_tv2" value="test" >
<f:validator validatorId="inplaceInputValidator" />
</rich:inplaceInput>
- <h:commandButton id="bn_tv2"
action="#{inplaceInputBean.action}" value="Submit"/>
+ <a4j:commandButton id="bn_tv2" reRender="group_tv2"
value="Submit"/>
</td>
<td><span id="text_tv2"><h:message
for="ii_tv2"></h:message></span></td>
</tr>
</table>
+ </h:panelGroup>
</h:form>
</ui:define>
</ui:composition>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java 2008-11-05
18:04:06 UTC (rev 11034)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java 2008-11-05
18:28:56 UTC (rev 11035)
@@ -6,7 +6,7 @@
public enum SeleniumEvent {
ONCLICK("onclick"),
- ONDBCLICK("ondbclick"),
+ ONDBLCLICK("ondblclick"),
ONMOUSEOVER("onmouseover"),
ONMOUSEMOVE("onmousemove"),
ONMOUSEOUT("onmouseout"),
@@ -15,8 +15,12 @@
ONDRAGANDDROP("ondraganddrop"),
ONKEYDOWN("onkeydown"),
ONKEYUP("onkeyup"),
- ONKEYPRESS("onkeypress");
+ ONKEYPRESS("onkeypress"),
+ ONFOCUS("onfocus"),
+ ONBLUR("onblur"),
+ ONCHANGE("onchange");
+
private String name;
@SuppressWarnings("serial")
@@ -28,6 +32,7 @@
};
static {
STANDARD_HTML_EVENTS.add(ONCLICK);
+ STANDARD_HTML_EVENTS.add(ONDBLCLICK);
STANDARD_HTML_EVENTS.add(ONMOUSEOVER);
STANDARD_HTML_EVENTS.add(ONMOUSEMOVE);
STANDARD_HTML_EVENTS.add(ONMOUSEOUT);
@@ -36,7 +41,9 @@
STANDARD_HTML_EVENTS.add(ONKEYDOWN);
STANDARD_HTML_EVENTS.add(ONKEYUP);
STANDARD_HTML_EVENTS.add(ONKEYPRESS);
-
+ STANDARD_HTML_EVENTS.add(ONBLUR);
+ STANDARD_HTML_EVENTS.add(ONFOCUS);
+ STANDARD_HTML_EVENTS.add(ONCHANGE);
}
private SeleniumEvent(String name) {
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-11-05
18:04:06 UTC (rev 11034)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-11-05
18:28:56 UTC (rev 11035)
@@ -1140,7 +1140,7 @@
for (SeleniumEvent ev : eventsExpected) {
if (ev == SeleniumEvent.ONCLICK) {
clickById(id);
- }else if (ev == SeleniumEvent.ONDBCLICK) {
+ }else if (ev == SeleniumEvent.ONDBLCLICK) {
selenium.doubleClick(id);
} else if (ev == SeleniumEvent.ONMOUSEDOWN) {
selenium.mouseDown(id);
@@ -1210,7 +1210,7 @@
for (SeleniumEvent ev : events) {
if (ev == SeleniumEvent.ONCLICK) {
clickById(id);
- }else if (ev == SeleniumEvent.ONDBCLICK) {
+ }else if (ev == SeleniumEvent.ONDBLCLICK) {
selenium.doubleClick(id);
} else if (ev == SeleniumEvent.ONMOUSEDOWN) {
selenium.mouseDown(id);
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-05
18:04:06 UTC (rev 11034)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-05
18:28:56 UTC (rev 11035)
@@ -1,9 +1,12 @@
package org.richfaces.testng;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.richfaces.testng.util.CommonUtils;
import org.testng.Assert;
@@ -61,6 +64,10 @@
private static final String VALIDATOR_PAGE_ID_PREFIX = "_tv";
+ private static final String STANDART_ATTRIBUTES_PAGE =
"testStandartAttributes.xhtml";
+
+ private static final String STANDART_ATTRIBUTES_ID_PREFIX = "_tsa";
+
private String testUrl;
private String formId;
@@ -325,13 +332,13 @@
String iid = inplaceInputId + VALIDATOR_PAGE_ID_PREFIX;
clickById(buttonId + VALIDATOR_PAGE_ID_PREFIX + "1");
- waitForPageToLoad();
+ waitForAjaxCompletion();
check("".equals(getTextById(messageId + VALIDATOR_PAGE_ID_PREFIX +
"1")),
CommonUtils.getSuccessfulTestMessage(iid + "1"),
CommonUtils.getFailedTestMessage(iid + "1"));
clickById(buttonId + VALIDATOR_PAGE_ID_PREFIX + "2");
- waitForPageToLoad();
+ waitForAjaxCompletion();
check("".equals(getTextById(messageId + VALIDATOR_PAGE_ID_PREFIX +
"2")),
CommonUtils.getSuccessfulTestMessage(iid + "2"),
CommonUtils.getFailedTestMessage(iid + "2"));
@@ -353,18 +360,49 @@
setValueById(iid + "2" + "value", "test1");
clickById(buttonId + VALIDATOR_PAGE_ID_PREFIX + "1");
- waitForPageToLoad();
+ waitForAjaxCompletion();
check("Value isn't correct!".equals(getTextById(messageId +
VALIDATOR_PAGE_ID_PREFIX + "1")),
CommonUtils.getSuccessfulTestMessage(iid + "1"),
CommonUtils.getFailedTestMessage(iid + "1"));
clickById(buttonId + VALIDATOR_PAGE_ID_PREFIX + "2");
- waitForPageToLoad();
+ waitForAjaxCompletion();
check("Value isn't correct!".equals(getTextById(messageId +
VALIDATOR_PAGE_ID_PREFIX + "2")),
CommonUtils.getSuccessfulTestMessage(iid + "2"),
CommonUtils.getFailedTestMessage(iid + "2"));
}
+ /**
+ * style and classes, standard HTML attributes are output to client
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testStandartAttributes(Template template) {
+ setTestUrl(STANDART_ATTRIBUTES_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + STANDART_ATTRIBUTES_ID_PREFIX;
+ Map<String, String> styleAttributes = new HashMap<String, String>();
+ styleAttributes.put("border", "3px");
+
+ List<SeleniumEvent> events = new ArrayList<SeleniumEvent>();
+ events.add(SeleniumEvent.ONMOUSEMOVE);
+ events.add(SeleniumEvent.ONMOUSEOUT);
+ events.add(SeleniumEvent.ONMOUSEOVER);
+ events.add(SeleniumEvent.ONCLICK);
+ events.add(SeleniumEvent.ONDBLCLICK);
+ events.add(SeleniumEvent.ONKEYDOWN);
+ events.add(SeleniumEvent.ONKEYPRESS);
+ events.add(SeleniumEvent.ONKEYUP);
+ events.add(SeleniumEvent.ONMOUSEUP);
+
+ assertClassNames(iid,new String [] {"classForInplaceinput"},
"Component's rendering invalid", true);
+ assertStyleAttributes(iid, styleAttributes);
+
+ assertEvents(iid, events);
+ }
+
private void typeAndCheck(String iid, String word, String expectedWord) {
typeWord(iid, word);
checkMessage(iid, expectedWord,