Author: vmolotkov
Date: 2008-11-11 11:51:48 -0500 (Tue, 11 Nov 2008)
New Revision: 11084
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testJSApi.xhtml
Modified:
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/testJSApi.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testJSApi.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testJSApi.xhtml 2008-11-11
16:51:48 UTC (rev 11084)
@@ -0,0 +1,30 @@
+<!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">testJSApi</ui:define>
+ <ui:define name="caseBody">
+ <h:form id="_form">
+ <h:panelGroup id="group_tpiv">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <rich:inplaceInput id="ii_tja" value="test"
showControls="true">
+ </rich:inplaceInput>
+
+ <button id="okButton_tja"
onclick="#{rich:component('ii_tja')}.save();return
false;">ok</button>
+ <button id="cancelButton_tja"
onclick="#{rich:component('ii_tja')}.cancel();return
false;">cancel</button>
+
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </h:panelGroup>
+ </h:form>
+ </ui:define>
+</ui:composition>
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-11
16:24:44 UTC (rev 11083)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-11
16:51:48 UTC (rev 11084)
@@ -81,6 +81,10 @@
private static final String PROCESSING_INVALID_VALUE_ID_PREFIX = "_tpiv";
+ private static final String JS_API_PAGE = "testJSApi.xhtml";
+
+ private static final String JS_API_ID_PREFIX = "_tja";
+
private String testUrl;
private String formId;
@@ -480,6 +484,40 @@
CommonUtils.getFailedTestMessage(iid));
}
+ /**
+ * Verify JS API of the component
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testJSApi(Template template) {
+ setTestUrl(JS_API_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + JS_API_ID_PREFIX;
+
+ selenium.runScript("var inplaceinput = ($('" + iid +
"')).component;");
+
//Assert.assertTrue("test".equals(selenium.getEval("window.inplaceinput.getValue()")));
+
+ //selenium.getEval("window.inplaceinput.setValue('',
'JSApi')");
+
//Assert.assertTrue("JSApi".equals(selenium.getEval("window.inplaceinput.getValue()")));
+
+ selenium.getEval("window.inplaceinput.edit()");
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto, auto, auto, auto)");
+ assertStyleAttributes(iid + "tempValue", expMap);
+
+ clickById(iid);
+ type(iid + "tempValue", "testInplaceInput");
+ selenium.getEval("window.inplaceinput.save()");
+ check("testInplaceInput".equals(getValueById(iid + "value")),
CommonUtils.getSuccessfulTestMessage(iid), CommonUtils.getFailedTestMessage(iid));
+
+ clickById(iid);
+ type(iid + "tempValue", "test");
+ selenium.getEval("window.inplaceinput.cancel()");
+ check("testInplaceInput".equals(getValueById(iid + "value")),
CommonUtils.getSuccessfulTestMessage(iid), CommonUtils.getFailedTestMessage(iid));
+ }
+
private void typeAndCheck(String iid, String word, String expectedWord) {
typeWord(iid, word);
checkMessage(iid, expectedWord,