Author: vmolotkov
Date: 2008-11-08 10:19:18 -0500 (Sat, 08 Nov 2008)
New Revision: 11062
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
Log:
tests for inplaceinput
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java 2008-11-07
23:46:52 UTC (rev 11061)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java 2008-11-08
15:19:18 UTC (rev 11062)
@@ -3,16 +3,24 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.validator.ValidatorException;
public class InplaceInputTestBean {
public final static class Messages {
+
public final static String ACTION_CALLED = "action called";
+
+ public final static String VALUECHANGELISTENER_CALLED = "listener called";
+
+ public final static String II_VALUE = "test";
}
private String text ="";
+ private String newText = "";
+
/**
* Gets value of text field.
* @return value of text field
@@ -33,9 +41,27 @@
setText(InplaceInputTestBean.Messages.ACTION_CALLED);
}
+ public void valueChangeListener(ValueChangeEvent ve) {
+ setNewText(Messages.VALUECHANGELISTENER_CALLED);
+ }
+
public void validator(FacesContext arg0, UIComponent arg1, Object arg2) {
if (!"test".equals(arg2)) {
throw new ValidatorException(new FacesMessage("Value isn't correct!"));
}
}
+
+ /**
+ * @return the newText
+ */
+ public String getNewText() {
+ return newText;
+ }
+
+ /**
+ * @param newText the newText to set
+ */
+ public void setNewText(String newText) {
+ this.newText = newText;
+ }
}
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml 2008-11-08
15:19:18 UTC (rev 11062)
@@ -0,0 +1,28 @@
+<!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">testImmediateAttribute</ui:define>
+ <ui:define name="caseBody">
+ <h:panelGroup id="group_tia">
+ <h:form id="_form">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <h:inputText value="" required="true"
></h:inputText>
+ <rich:inplaceInput id="ii_tia"
value="#{inplaceInputBean.text}"
validator="#{inplaceInputBean.validator}" immediate="true">
+ </rich:inplaceInput>
+ <a4j:commandButton id="bn_tia" reRender="group_tia"
value="Submit"/>
+ </td>
+ <td><span
id="text_tia">#{inplaceInputBean.text}<h:messages
/></span></td>
+ </tr>
+ </table>
+ </h:form>
+ </h:panelGroup>
+ </ui:define>
+</ui:composition>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml 2008-11-08
15:19:18 UTC (rev 11062)
@@ -0,0 +1,27 @@
+<!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">testValueChangeListener</ui:define>
+ <ui:define name="caseBody">
+ <h:panelGroup id="group_tvcl">
+ <h:form id="_form">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <rich:inplaceInput id="ii_tvcl"
value="#{inplaceInputBean.text}"
valueChangeListener="#{inplaceInputBean.valueChangeListener}">
+ </rich:inplaceInput>
+ <a4j:commandButton id="bn_tvcl" reRender="group_tvcl"
value="Submit"/>
+ </td>
+ <td><span
id="text_tvcl">#{inplaceInputBean.text}#{inplaceInputBean.newText}</span></td>
+ </tr>
+ </table>
+ </h:form>
+ </h:panelGroup>
+ </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-07
23:46:52 UTC (rev 11061)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-08
15:19:18 UTC (rev 11062)
@@ -5,6 +5,7 @@
import java.util.List;
import java.util.Map;
+import org.ajax4jsf.bean.InplaceInputTestBean;
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
@@ -68,6 +69,14 @@
private static final String STANDART_ATTRIBUTES_ID_PREFIX = "_tsa";
+ private static final String IMMEDIATE_ATTRIBUTE_PAGE =
"testImmediateAttribute.xhtml";
+
+ private static final String IMMEDIATE_ATTRIBUTE_ID_PREFIX = "_tia";
+
+ private static final String VALUE_CHANGE_LISTENER_PAGE =
"testValueChangeListener.xhtml";
+
+ private static final String VALUE_CHANGE_LISTENER_ID_PREFIX = "_tvcl";
+
private String testUrl;
private String formId;
@@ -78,248 +87,248 @@
private String messageId;
-// @Test
-// public void testInplaceInputComponentLayout(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-// writeStatus("Check component layout");
-//
-// String inplaceInputS = getParentId() + "_form:" +
INPLACE_INPUT_SIMPLE;
-// String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
-//
-// Assert.assertTrue(isPresentById(inplaceInputS));
-// int count = selenium.getXpathCount("//*[@id='" + inplaceInputS +
"' and (name()='span' or name()='SPAN')]").intValue();
-// Assert.assertTrue(count == 1, "InplaceInput[" + inplaceInputS +
"] has layout=inline(default) and should be rendered as 'span'
element");
-//
-// Assert.assertTrue(isPresentById(inplaceInputD));
-// count = selenium.getXpathCount("//*[@id='" + inplaceInputD +
"' and (name()='DIV' or name()='div')]").intValue();
-// Assert.assertTrue(count == 1, "InplaceInput [" + inplaceInputD +
"] has layout=block and should be rendered as 'div' element");
-//
-// }
-//
-// @Test
-// public void testInplaceInputClientAPI(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-// writeStatus("Check component client API");
-// }
-//
-// @Test
-// public void testInplaceInputEvents(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-//
-// writeStatus("Check component event triggering");
-//
-// String inplaceInputS = getParentId() + "_form:" +
INPLACE_INPUT_SIMPLE;
-// String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
-// String inplaceInputDOk = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_OK;
-// String inplaceInputDCancel = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_CANCEL;
-//
-// writeStatus("Click first component being tested");
-//
-// clickById(inplaceInputS);
-// AssertTextEquals(inplaceInputS + "_edit",
EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
-//
-// writeStatus("Stop editing first component being tested");
-//
-// String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
-// selenium.fireEvent(inplaceInputSInput, "blur");
-//
-// AssertTextEquals(inplaceInputS + "_view",
EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
-//
-// writeStatus("Double-click second component being tested");
-//
-// selenium.doubleClick(inplaceInputD);
-// AssertTextEquals(inplaceInputD + "_edit",
EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
-// type(inplaceInputSInput, "Hello");
-//
-// writeStatus("Stop editing second component being tested");
-//
-// selenium.mouseDown(inplaceInputDOk);
-//
-// AssertTextEquals(inplaceInputD + "_view",
EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
-// }
-//
-// @Test
-// public void testInplaceInputKeyAttributes(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-//
-// String inplaceInputS = getParentId() + "_form:" +
INPLACE_INPUT_SIMPLE;
-// String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
-//
-// String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
-// String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
-//
-// writeStatus("Check component's key attributes");
-//
-// writeStatus("test 'editEvent' attribute");
-//
-// writeStatus("The first component must change your state by single clicking
only");
-// clickById(inplaceInputS);
-// AssertVisible(inplaceInputSInput);
-//
-// writeStatus("The second component must change your state by double
clicking only");
-// selenium.doubleClick(inplaceInputD);
-// AssertVisible(inplaceInputDInput);
-// }
-//
-// @Test
-// public void testInplaceInputComponentCore(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-//
-// String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
-// String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
-// String inplaceInputDOk = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_OK;
-// String inplaceInputDCancel = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_CANCEL;
-//
-// writeStatus("Check component's core functionality");
-//
-// writeStatus("Double-click the second component and type an initial
text");
-// selenium.doubleClick(inplaceInputD);
-// type(inplaceInputDInput, "Sun");
-//
-// writeStatus("Stop editing with ok. The input has to be saved");
-// selenium.mouseDown(inplaceInputDOk);
-// String sun = invokeFromComponent(inplaceInputD, "getValue", null);
-// Assert.assertEquals(sun, "Sun", "An inputted text has not been
saved with ok");
-// //AssertTextEquals(inplaceInputD, "Sun", "An inputted text has
not been saved with ok");
-//
-// writeStatus("Double-click the second component again and type a new
text");
-// selenium.doubleClick(inplaceInputD);
-// type(inplaceInputDInput, "Moon");
-//
-// writeStatus("Stop editing with cancel. The input has not to be
saved");
-// selenium.mouseDown(inplaceInputDCancel);
-//
-// sun = invokeFromComponent(inplaceInputD, "getValue", null);
-// Assert.assertEquals(sun, "Sun", "An inputted text has not to be
saved with cancel");
-// //AssertTextEquals(inplaceInputD, "Sun", "An inputted text has
not to be saved with cancel");
-//
-// }
+ @Test
+ public void testInplaceInputComponentLayout(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+ writeStatus("Check component layout");
+
+ String inplaceInputS = getParentId() + "_form:" +
INPLACE_INPUT_SIMPLE;
+ String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
+
+ Assert.assertTrue(isPresentById(inplaceInputS));
+ int count = selenium.getXpathCount("*[@id='" + inplaceInputS +
"' and (name()='span' or name()='SPAN')]").intValue();
+ Assert.assertTrue(count == 1, "InplaceInput[" + inplaceInputS + "]
has layout=inline(default) and should be rendered as 'span' element");
+
+ Assert.assertTrue(isPresentById(inplaceInputD));
+ count = selenium.getXpathCount("*[@id='" + inplaceInputD +
"' and (name()='DIV' or name()='div')]").intValue();
+ Assert.assertTrue(count == 1, "InplaceInput [" + inplaceInputD +
"] has layout=block and should be rendered as 'div' element");
+
+ }
+
+ @Test
+ public void testInplaceInputClientAPI(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+ writeStatus("Check component client API");
+ }
+
+ @Test
+ public void testInplaceInputEvents(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+
+ writeStatus("Check component event triggering");
+
+ String inplaceInputS = getParentId() + "_form:" +
INPLACE_INPUT_SIMPLE;
+ String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
+ String inplaceInputDOk = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_OK;
+ String inplaceInputDCancel = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_CANCEL;
+
+ writeStatus("Click first component being tested");
+
+ clickById(inplaceInputS);
+ AssertTextEquals(inplaceInputS + "_edit",
EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
+
+ writeStatus("Stop editing first component being tested");
+
+ String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
+ selenium.fireEvent(inplaceInputSInput, "blur");
+
+ AssertTextEquals(inplaceInputS + "_view",
EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
+
+ writeStatus("Double-click second component being tested");
+
+ selenium.doubleClick(inplaceInputD);
+ AssertTextEquals(inplaceInputD + "_edit",
EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
+ type(inplaceInputSInput, "Hello");
+
+ writeStatus("Stop editing second component being tested");
+
+ selenium.mouseDown(inplaceInputDOk);
+
+ AssertTextEquals(inplaceInputD + "_view",
EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
+ }
+
+ @Test
+ public void testInplaceInputKeyAttributes(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+
+ String inplaceInputS = getParentId() + "_form:" +
INPLACE_INPUT_SIMPLE;
+ String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
+
+ String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
+ String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
+
+ writeStatus("Check component's key attributes");
+
+ writeStatus("test 'editEvent' attribute");
+
+ writeStatus("The first component must change your state by single clicking
only");
+ clickById(inplaceInputS);
+ AssertVisible(inplaceInputSInput);
+
+ writeStatus("The second component must change your state by double clicking
only");
+ selenium.doubleClick(inplaceInputD);
+ AssertVisible(inplaceInputDInput);
+ }
+
+ @Test
+ public void testInplaceInputComponentCore(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+
+ String inplaceInputD = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED;
+ String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
+ String inplaceInputDOk = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_OK;
+ String inplaceInputDCancel = getParentId() + "_form:" +
INPLACE_INPUT_DECORATED_CANCEL;
+
+ writeStatus("Check component's core functionality");
+
+ writeStatus("Double-click the second component and type an initial
text");
+ selenium.doubleClick(inplaceInputD);
+ type(inplaceInputDInput, "Sun");
+
+ writeStatus("Stop editing with ok. The input has to be saved");
+ selenium.mouseDown(inplaceInputDOk);
+ String sun = invokeFromComponent(inplaceInputD, "getValue", null);
+ Assert.assertEquals(sun, "Sun", "An inputted text has not been
saved with ok");
+ AssertTextEquals(inplaceInputD, "Sun", "An inputted text has not
been saved with ok");
+
+ writeStatus("Double-click the second component again and type a new
text");
+ selenium.doubleClick(inplaceInputD);
+ type(inplaceInputDInput, "Moon");
+
+ writeStatus("Stop editing with cancel. The input has not to be
saved");
+ selenium.mouseDown(inplaceInputDCancel);
+
+ sun = invokeFromComponent(inplaceInputD, "getValue", null);
+ Assert.assertEquals(sun, "Sun", "An inputted text has not to be
saved with cancel");
+ AssertTextEquals(inplaceInputD, "Sun", "An inputted text has not
to be saved with cancel");
+
+ }
-// /**
-// * 'required' and 'requiredMessage' attributes work
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testRequiredAttributes(Template template) {
-// setTestUrl(REQUIRED_ATTRIBUTES_PAGE);
-// init(template);
-//
-// selenium.click("id=" + buttonId + REQUIRED_ATTRIBUTES_ID_PREFIX);
-// waitForPageToLoad();
-// checkMessage(messageId + REQUIRED_ATTRIBUTES_ID_PREFIX,
"text:requiredMsg", CommonUtils.getSuccessfulTestMessage(inplaceInputId +
REQUIRED_ATTRIBUTES_ID_PREFIX), CommonUtils.getFailedTestMessage(inplaceInputId +
REQUIRED_ATTRIBUTES_ID_PREFIX));
-// }
-//
-// /**
-// * Check 'editEvent' attribute
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testEditEventAttribute(Template template) {
-// setTestUrl(EDITEVENT_ATTRIBUTES_PAGE);
-// init(template);
-//
-// selenium.doubleClick(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX);
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX +
"tempValue", expMap);
-// }
-//
-// /**
-// * Check 'controls' facet
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testControlsFacet(Template template) {
-// setTestUrl(CONTROLS_FACET_PAGE);
-// init(template);
-//
-// check((isPresentById(CONTROLS_FACET_BN_OK + CONTROLS_FACET_ID_PREFIX) ||
isPresentById(CONTROLS_FACET_BN_CANCEL + CONTROLS_FACET_ID_PREFIX)),
-// CommonUtils.getSuccessfulTestMessage(inplaceInputId +
CONTROLS_FACET_ID_PREFIX),
-// 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");
-// }
-//
-// /**
-// * Verify component behaviour with showControls="false" attribute
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testShowControlsAttribute1(Template template) {
-// setTestUrl(SHOW_CONTROLS_ATTRIBUTE1_PAGE);
-// init(template);
-//
-// String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE1_PAGE_ID_PREFIX;
-//
-// clickById(iid);
-// check(!isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-//
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// selenium.fireEvent(iid + "tempValue", "blur");
-// expMap.remove("clip");
-// expMap.put("clip", "rect(0px 0px 0px 0px)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// }
-//
-// /**
-// * The same as previous but with showControls="true" attribute
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testShowControlsAttribute2(Template template) {
-// setTestUrl(SHOW_CONTROLS_ATTRIBUTE2_PAGE);
-// init(template);
-//
-// String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE2_PAGE_ID_PREFIX;
-//
-// clickById(iid);
-// check(isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-//
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// selenium.fireEvent(iid + "tempValue", "blur");
-// expMap.remove("clip");
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// }
+ /**
+ * 'required' and 'requiredMessage' attributes work
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testRequiredAttributes(Template template) {
+ setTestUrl(REQUIRED_ATTRIBUTES_PAGE);
+ init(template);
+
+ selenium.click("id=" + buttonId + REQUIRED_ATTRIBUTES_ID_PREFIX);
+ waitForPageToLoad();
+ checkMessage(messageId + REQUIRED_ATTRIBUTES_ID_PREFIX,
"text:requiredMsg", CommonUtils.getSuccessfulTestMessage(inplaceInputId +
REQUIRED_ATTRIBUTES_ID_PREFIX), CommonUtils.getFailedTestMessage(inplaceInputId +
REQUIRED_ATTRIBUTES_ID_PREFIX));
+ }
/**
+ * Check 'editEvent' attribute
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testEditEventAttribute(Template template) {
+ setTestUrl(EDITEVENT_ATTRIBUTES_PAGE);
+ init(template);
+
+ selenium.doubleClick(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX);
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX +
"tempValue", expMap);
+ }
+
+ /**
+ * Check 'controls' facet
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testControlsFacet(Template template) {
+ setTestUrl(CONTROLS_FACET_PAGE);
+ init(template);
+
+ check((isPresentById(CONTROLS_FACET_BN_OK + CONTROLS_FACET_ID_PREFIX) ||
isPresentById(CONTROLS_FACET_BN_CANCEL + CONTROLS_FACET_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX),
+ 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");
+ }
+
+ /**
+ * Verify component behaviour with showControls="false" attribute
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testShowControlsAttribute1(Template template) {
+ setTestUrl(SHOW_CONTROLS_ATTRIBUTE1_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE1_PAGE_ID_PREFIX;
+
+ clickById(iid);
+ check(!isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ selenium.fireEvent(iid + "tempValue", "blur");
+ expMap.remove("clip");
+ expMap.put("clip", "rect(0px 0px 0px 0px)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ }
+
+ /**
+ * The same as previous but with showControls="true" attribute
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testShowControlsAttribute2(Template template) {
+ setTestUrl(SHOW_CONTROLS_ATTRIBUTE2_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE2_PAGE_ID_PREFIX;
+
+ clickById(iid);
+ check(isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ selenium.fireEvent(iid + "tempValue", "blur");
+ expMap.remove("clip");
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ }
+
+ /**
* Validator defined by component attribute and nested tags work
*
* @param template - current template
@@ -373,6 +382,48 @@
}
/**
+ * Immediate = true component works respectively
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testImmediateAttribute(Template template) {
+ setTestUrl(IMMEDIATE_ATTRIBUTE_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + IMMEDIATE_ATTRIBUTE_ID_PREFIX;
+
+ setValueById(iid + "value", "test1");
+ clickById(buttonId + IMMEDIATE_ATTRIBUTE_ID_PREFIX);
+ waitForAjaxCompletion();
+ check("Value isn't correct!".equals(getTextById(messageId +
IMMEDIATE_ATTRIBUTE_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+ }
+
+ /**
+ * valueChangeListener should fire on submit
+ * and model binding should be updated on value changed
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testValueChangeListener(Template template) {
+ setTestUrl(VALUE_CHANGE_LISTENER_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + VALUE_CHANGE_LISTENER_ID_PREFIX;
+
+ setValueById(iid + "value", "test1");
+ clickById(buttonId + VALUE_CHANGE_LISTENER_ID_PREFIX);
+ waitForAjaxCompletion();
+ check(("test1" +
InplaceInputTestBean.Messages.VALUECHANGELISTENER_CALLED).equals(getTextById(messageId +
VALUE_CHANGE_LISTENER_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+ }
+
+
+ /**
* style and classes, standard HTML attributes are output to client
*
* @param template - current template