Author: vmolotkov
Date: 2008-10-30 12:42:08 -0400 (Thu, 30 Oct 2008)
New Revision: 10987
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testDefaultLabelAndSpaces.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/testDefaultLabelAndSpaces.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testDefaultLabelAndSpaces.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testDefaultLabelAndSpaces.xhtml 2008-10-30
16:42:08 UTC (rev 10987)
@@ -0,0 +1,16 @@
+<!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">testControlsFacet</ui:define>
+ <ui:define name="caseBody">
+ <h:form id="_form">
+ <rich:inplaceInput id="ii_dfas" value=""
defaultLabel="defaultLabel">
+ </rich:inplaceInput>
+ </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-10-30
15:48:59 UTC (rev 10986)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-10-30
16:42:08 UTC (rev 10987)
@@ -43,6 +43,10 @@
private static final String CONTROLS_FACET_BN_CANCEL = "cancel";
+ private static final String DEFAULTLABEL_AND_SPACES_PAGE =
"testDefaultLabelAndSpaces.xhtml";
+
+ private static final String DEFAULTLABEL_AND_SPACES_PAGE_ID_PREFIX =
"_dfas";
+
private String testUrl;
private String formId;
@@ -187,7 +191,7 @@
selenium.click("id=" + buttonId + REQUIRED_ATTRIBUTES_ID_PREFIX);
waitForPageToLoad();
- checkMessage(messageId + REQUIRED_ATTRIBUTES_ID_PREFIX, "requiredMsg",
CommonUtils.getSuccessfulTestMessage(inplaceInputId + REQUIRED_ATTRIBUTES_ID_PREFIX),
CommonUtils.getFailedTestMessage(inplaceInputId + REQUIRED_ATTRIBUTES_ID_PREFIX));
+ checkMessage(messageId + REQUIRED_ATTRIBUTES_ID_PREFIX,
"text:requiredMsg", CommonUtils.getSuccessfulTestMessage(inplaceInputId +
REQUIRED_ATTRIBUTES_ID_PREFIX), CommonUtils.getFailedTestMessage(inplaceInputId +
REQUIRED_ATTRIBUTES_ID_PREFIX));
}
/**
@@ -221,9 +225,43 @@
CommonUtils.getFailedTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX));
}
+ /**
+ * Input some spaces in inplaceInput; verify that defaultLabel is
+ * displayed after selecting; component does not disappear from the page
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testDefaultLabelAndSpaces(Template template) {
+ setTestUrl(DEFAULTLABEL_AND_SPACES_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + DEFAULTLABEL_AND_SPACES_PAGE_ID_PREFIX;
+
+ checkMessage(iid, "defaultLabel",
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+
+ typeAndCheck(iid, " ", "defaultLabel");
+ typeAndCheck(iid, "test", "test");
+ }
+
+ private void typeAndCheck(String iid, String word, String expectedWord) {
+ typeWord(iid, word);
+ checkMessage(iid, expectedWord,
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+ }
+
+ private void typeWord(String iid, String word) {
+ clickById(iid);
+ type(iid + "tempValue", word);
+ selenium.fireEvent(iid + "tempValue", "blur");
+ }
+
private void checkMessage(String elementId, String expectedValue, String okMsg,
String errMsg) {
String currentValue = getTextById(elementId);
- check(("text:" + expectedValue).equals(currentValue), okMsg, errMsg);
+ check((expectedValue).equals(currentValue), okMsg, errMsg);
}
private void check(boolean expression, String okMsg, String errMsg) {