Author: ppitonak(a)redhat.com
Date: 2011-02-16 10:56:50 -0500 (Wed, 16 Feb 2011)
New Revision: 21701
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/fAjax.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInputFAjax.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/list.xhtml
Log:
added new sample and test for rich:inplaceInput+f:ajax
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/fAjax.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/fAjax.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/fAjax.xhtml 2011-02-16
15:56:50 UTC (rev 21701)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich" >
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:inplaceInput id="inplaceInput"
+
changedStateClass="#{richInplaceInputBean.attributes['changedStateClass'].value}"
+
converter="#{richInplaceInputBean.attributes['converter'].value}"
+
converterMessage="#{richInplaceInputBean.attributes['converterMessage'].value}"
+
defaultLabel="#{richInplaceInputBean.attributes['defaultLabel'].value}"
+
disabled="#{richInplaceInputBean.attributes['disabled'].value}"
+
disabledStateClass="#{richInplaceInputBean.attributes['disabledStateClass'].value}"
+
editClass="#{richInplaceInputBean.attributes['editClass'].value}"
+
editEvent="#{richInplaceInputBean.attributes['editEvent'].value}"
+
editStateClass="#{richInplaceInputBean.attributes['editStateClass'].value}"
+
immediate="#{richInplaceInputBean.attributes['immediate'].value}"
+
inputWidth="#{richInplaceInputBean.attributes['inputWidth'].value}"
+
noneClass="#{richInplaceInputBean.attributes['noneClass'].value}"
+
onblur="#{richInplaceInputBean.attributes['onblur'].value}"
+
onclick="#{richInplaceInputBean.attributes['onclick'].value}"
+
onchange="#{richInplaceInputBean.attributes['onchange'].value}"
+
ondblclick="#{richInplaceInputBean.attributes['ondblclick'].value}"
+
onfocus="#{richInplaceInputBean.attributes['onfocus'].value}"
+
oninputclick="#{richInplaceInputBean.attributes['oninputclick'].value}"
+
oninputdblclick="#{richInplaceInputBean.attributes['oninputdblclick'].value}"
+
oninputkeydown="#{richInplaceInputBean.attributes['oninputkeydown'].value}"
+
oninputkeypress="#{richInplaceInputBean.attributes['oninputkeypress'].value}"
+
oninputkeyup="#{richInplaceInputBean.attributes['oninputkeyup'].value}"
+
oninputmousedown="#{richInplaceInputBean.attributes['oninputmousedown'].value}"
+
oninputmousemove="#{richInplaceInputBean.attributes['oninputmousemove'].value}"
+
oninputmouseout="#{richInplaceInputBean.attributes['oninputmouseout'].value}"
+
oninputmouseover="#{richInplaceInputBean.attributes['oninputmouseover'].value}"
+
oninputmouseup="#{richInplaceInputBean.attributes['oninputmouseup'].value}"
+
oninputselect="#{richInplaceInputBean.attributes['oninputselect'].value}"
+
onkeydown="#{richInplaceInputBean.attributes['onkeydown'].value}"
+
onkeypress="#{richInplaceInputBean.attributes['onkeypress'].value}"
+
onkeyup="#{richInplaceInputBean.attributes['onkeyup'].value}"
+
onmousedown="#{richInplaceInputBean.attributes['onmousedown'].value}"
+
onmousemove="#{richInplaceInputBean.attributes['onmousemove'].value}"
+
onmouseout="#{richInplaceInputBean.attributes['onmouseout'].value}"
+
onmouseover="#{richInplaceInputBean.attributes['onmouseover'].value}"
+
onmouseup="#{richInplaceInputBean.attributes['onmouseup'].value}"
+
readyStateClass="#{richInplaceInputBean.attributes['readyStateClass'].value}"
+
rendered="#{richInplaceInputBean.attributes['rendered'].value}"
+
required="#{richInplaceInputBean.attributes['required'].value}"
+
requiredMessage="#{richInplaceInputBean.attributes['requiredMessage'].value}"
+
saveOnBlur="#{richInplaceInputBean.attributes['saveOnBlur'].value}"
+
showControls="#{richInplaceInputBean.attributes['showControls'].value}"
+
style="#{richInplaceInputBean.attributes['style'].value}"
+
tabindex="#{richInplaceInputBean.attributes['tabindex'].value}"
+
validatorMessage="#{richInplaceInputBean.attributes['validatorMessage'].value}"
+
value="#{richInplaceInputBean.attributes['value'].value}"
+
valueChangeListener="#{richBean.valueChangeListener}"
+ >
+
+ <f:ajax event="change" render="output
:phasesPanel"/>
+
+ </rich:inplaceInput>
+
+ <br/><br/>
+
+ output: <h:outputText id="output"
value="#{richInplaceInputBean.attributes['value'].value}"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richInplaceInputBean.attributes}"
id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/list.xhtml 2011-02-16
15:52:15 UTC (rev 21700)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/list.xhtml 2011-02-16
15:56:50 UTC (rev 21701)
@@ -32,9 +32,13 @@
<ui:define name="links">
<metamer:testPageLink id="simple" outcome="simple"
value="Simple">
- Simple page that contains <b>rich:inplaceInput</b> and input
boxes for all its attributes.
+ Simple page that contains <b>rich:inplaceInput</b> with
a4j:ajax and input boxes for all its attributes.
</metamer:testPageLink>
+ <metamer:testPageLink id="fAjax" outcome="fAjax"
value="f:ajax">
+ Simple page that contains <b>rich:inplaceInput</b> with
f:ajax and input boxes for all its attributes.
+ </metamer:testPageLink>
+
</ui:define>
</ui:composition>
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInputFAjax.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInputFAjax.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInputFAjax.java 2011-02-16
15:56:50 UTC (rev 21701)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richInplaceInput;
+
+import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import javax.faces.event.PhaseId;
+
+import org.jboss.test.selenium.css.CssProperty;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.waiting.EventFiredCondition;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/richInplaceInput/fAjax.xhtml.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichInplaceInputFAjax extends AbstractMetamerTest {
+
+ private JQueryLocator inplaceInput = pjq("span[id$=inplaceInput]");
+ private JQueryLocator label = pjq("span.rf-ii-lbl");
+ private JQueryLocator input = pjq("input[id$=inplaceInputInput]");
+ private JQueryLocator edit = pjq("span.rf-ii-edit");
+ private JQueryLocator okButton = pjq("input.rf-ii-btn[id$=Okbtn]");
+ private JQueryLocator cancelButton =
pjq("input.rf-ii-btn[id$=Cancelbtn]");
+ private JQueryLocator output = pjq("span[id$=output]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richInplaceInput/fAjax.xhtml");
+ }
+
+ @Test
+ public void testClick() {
+ guardNoRequest(selenium).click(inplaceInput);
+ assertFalse(selenium.belongsClass(edit, "rf-ii-none"), "Edit
should not contain class rf-is-none when popup is open.");
+ assertTrue(selenium.isDisplayed(input), "Input should be displayed.");
+
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+ assertTrue(selenium.belongsClass(inplaceInput, "rf-ii-c-s"), "New
class should be added to inplace input.");
+ assertTrue(selenium.belongsClass(edit, "rf-ii-none"), "Edit should
contain class rf-is-none when popup is closed.");
+
+ assertEquals(selenium.getText(label), "new value", "Label should
contain selected value.");
+ assertEquals(selenium.getText(output), "new value", "Output did
not change.");
+
+ String listenerText = selenium.getText(jq("div#phasesPanel
li:eq(3)"));
+ assertEquals(listenerText, "* value changed: RichFaces 4 -> new
value", "Value change listener was not invoked.");
+
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.PROCESS_VALIDATIONS, "value changed:
RichFaces 4 -> new value");
+ }
+}