Author: jpapouse
Date: 2011-07-20 06:21:07 -0400 (Wed, 20 Jul 2011)
New Revision: 22557
Added:
modules/tests/metamer/branches/sandbox-components/
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/list.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/AbstractWatermarkTest.java
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputSecret.java
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputText.java
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputTextArea.java
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichAutocomplete.java
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichCalendar.java
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichSelect.java
Modified:
modules/tests/metamer/branches/sandbox-components/application/pom.xml
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
new branch [sandbox-components]:
RFPL-1520: added watermark component to metamer application
RFPL-1521: added selenium tests for watermark component
Modified: modules/tests/metamer/branches/sandbox-components/application/pom.xml
===================================================================
--- modules/tests/metamer/trunk/application/pom.xml 2011-07-20 06:54:17 UTC (rev 22556)
+++ modules/tests/metamer/branches/sandbox-components/application/pom.xml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -62,6 +62,12 @@
<artifactId>annotations</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.sandbox.ui.watermark</groupId>
+ <artifactId>watermark-ui</artifactId>
+ <version>4.1.0-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-07-20
06:54:17 UTC (rev 22556)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -121,7 +121,8 @@
otherComponents.put("commandButton", "JSF Command Button");
otherComponents.put("hDataTable", "JSF Data Table");
otherComponents.put("uiRepeat", "UI Repeat");
-
+ otherComponents.put("watermark", "Watermark");
+
richComponents.put("richAccordion", "Rich Accordion");
richComponents.put("richAccordionItem", "Rich Accordion
Item");
richComponents.put("richAutocomplete", "Rich Autocomplete");
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,85 @@
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.ViewScoped;
+import javax.faces.convert.Converter;
+
+import org.richfaces.component.AbstractWatermark;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for watermark:watermark
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ *
+ */
+@ManagedBean(name = "watermarkBean")
+@ViewScoped
+public class WatermarkBean implements Serializable {
+
+ public static final String DEFAULT_WATERMARK_TEXT = "Watermark text";
+ private static final long serialVersionUID = -3976697340610316015L;
+ private static Logger logger;
+ private Attributes attributes;
+ @ManagedProperty(value = "#{constantConverter}")
+ private Converter converter;
+ private Object watermarkedObject;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getComponentAttributesFromClass(AbstractWatermark.class,
getClass());
+ attributes.setAttribute("for", "watermarked");
+ attributes.setAttribute("rendered", true);
+ attributes.setAttribute("value", DEFAULT_WATERMARK_TEXT);
+// attributes.setAttribute("converter", converter);
+ attributes.remove("suffix");
+ attributes.remove("title");
+ }
+
+ /**
+ * Getter for attributes.
+ *
+ * @return A map containing all attributes of tested component. Name of the component
is key in the map.
+ */
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public Converter getConverter() {
+ return converter;
+ }
+
+ public Object getWatermarkedObject() {
+ return watermarkedObject;
+ }
+
+ /**
+ * Setter for attributes.
+ *
+ * @param attributes
+ * map containing all attributes of tested component. Name of the
component is key in the map.
+ */
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public void setConverter(Converter converter) {
+ this.converter = converter;
+ }
+
+ public void setWatermarkedObject(Object object) {
+ this.watermarkedObject = object;
+ }
+
+}
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,57 @@
+<?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:watermark="http://richfaces.org/sandbox/watermark"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+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="component">
+ <h:form>
+
+ <h:inputSecret id="watermarked">
+ <a4j:ajax event="change" execute="@form"
render="output"/>
+ </h:inputSecret>
+
+ <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+
for="#{watermarkBean.attributes['for'].value}"
+
rendered="#{watermarkBean.attributes['rendered'].value}"
+
value="#{watermarkBean.attributes['value'].value}"
+
title="#{watermarkBean.attributes['title'].value}"
+ />
+
+ <a4j:outputPanel id="output" layout="block">
+ <h:outputText value="#{watermarkBean.watermarkedObject}"
/>
+ </a4j:outputPanel>
+
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{watermarkBean.attributes}"
id="attributes" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,57 @@
+<?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:watermark="http://richfaces.org/sandbox/watermark"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+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="component">
+ <h:form>
+
+ <h:inputText id="watermarked">
+ <a4j:ajax event="change" execute="@form"
render="output"/>
+ </h:inputText>
+
+ <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+
for="#{watermarkBean.attributes['for'].value}"
+
rendered="#{watermarkBean.attributes['rendered'].value}"
+
value="#{watermarkBean.attributes['value'].value}"
+
title="#{watermarkBean.attributes['title'].value}"
+ />
+
+ <a4j:outputPanel id="output" layout="block">
+ <h:outputText value="#{watermarkBean.watermarkedObject}"
/>
+ </a4j:outputPanel>
+
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{watermarkBean.attributes}"
id="attributes" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,57 @@
+<?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:watermark="http://richfaces.org/sandbox/watermark"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+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="component">
+ <h:form>
+
+ <h:inputTextarea id="watermarked">
+ <a4j:ajax event="change" execute="@form"
render="output"/>
+ </h:inputTextarea>
+
+ <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+
for="#{watermarkBean.attributes['for'].value}"
+
rendered="#{watermarkBean.attributes['rendered'].value}"
+
value="#{watermarkBean.attributes['value'].value}"
+
title="#{watermarkBean.attributes['title'].value}"
+ />
+
+ <a4j:outputPanel id="output" layout="block">
+ <h:outputText value="#{watermarkBean.watermarkedObject}"
/>
+ </a4j:outputPanel>
+
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{watermarkBean.attributes}"
id="attributes" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/list.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/list.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/list.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,63 @@
+<?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:a4j="http://richfaces.org/a4j"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+<!--
+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/list.xhtml">
+
+ <ui:define name="pageTitle">Watermark</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="richAutocomplete"
outcome="richAutocomplete" value="Autocomplete">
+ Simple page that contains <b>watermark:watermark</b> with
<b>rich:autocomplete</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="richCalendar"
outcome="richCalendar" value="Calendar">
+ Simple page that contains <b>watermark:watermark</b> with
<b>rich:calendar</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="hInputSecret"
outcome="hInputSecret" value="Input Secret">
+ Simple page that contains <b>watermark:watermark</b> with
<b>h:inputSecret</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="richSelect"
outcome="richSelect" value="Select">
+ Simple page that contains <b>watermark:watermark</b> with
<b>rich:select</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="hInputText"
outcome="hInputText" value="Input Text">
+ Simple page that contains <b>watermark:watermark</b> with
<b>h:inputText</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="hInputTextArea"
outcome="hInputTextArea" value="Input Text Area">
+ Simple page that contains <b>watermark:watermark</b> with
<b>h:inputTextArea</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,62 @@
+<?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:watermark="http://richfaces.org/sandbox/watermark"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j"
+
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="component">
+ <h:form>
+
+ <rich:autocomplete
autocompleteMethod="#{richAutocompleteBean.autocomplete}"
+ id="watermarked"
+ >
+ <a4j:ajax event="change" execute="@form"
render="output"/>
+ </rich:autocomplete>
+
+
+ <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+
for="#{watermarkBean.attributes['for'].value}"
+
rendered="#{watermarkBean.attributes['rendered'].value}"
+ suffix="Input"
+
value="#{watermarkBean.attributes['value'].value}"
+
title="#{watermarkBean.attributes['title'].value}"
+ />
+
+ <a4j:outputPanel id="output" layout="block">
+ <h:outputText value="#{watermarkBean.watermarkedObject}"
/>
+ </a4j:outputPanel>
+
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{watermarkBean.attributes}"
id="attributes" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,59 @@
+<?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:watermark="http://richfaces.org/sandbox/watermark"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j"
+
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="component">
+ <h:form>
+
+ <rich:calendar id="watermarked"
enableManualInput="true">
+ <a4j:ajax event="change" execute="@form"
render="output"/>
+ </rich:calendar>
+
+
+ <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+
for="#{watermarkBean.attributes['for'].value}"
+
rendered="#{watermarkBean.attributes['rendered'].value}"
+ suffix="InputDate"
+
value="#{watermarkBean.attributes['value'].value}"
+ />
+
+ <a4j:outputPanel id="output" layout="block">
+ <h:outputText value="#{watermarkBean.watermarkedObject}"
/>
+ </a4j:outputPanel>
+
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{watermarkBean.attributes}"
id="attributes" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,61 @@
+<?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:watermark="http://richfaces.org/sandbox/watermark"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j"
+
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="component">
+ <h:form>
+
+ <rich:select id="watermarked"
enableManualInput="true">
+ <f:selectItems value="#{richSelectBean.capitalsOptions}"
/>
+ <a4j:ajax event="change" execute="@form"
render="output"/>
+ </rich:select>
+
+
+ <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+
for="#{watermarkBean.attributes['for'].value}"
+
rendered="#{watermarkBean.attributes['rendered'].value}"
+ suffix="Input"
+
value="#{watermarkBean.attributes['value'].value}"
+
title="#{watermarkBean.attributes['title'].value}"
+ />
+
+ <a4j:outputPanel id="output" layout="block">
+ <h:outputText value="#{watermarkBean.watermarkedObject}"
/>
+ </a4j:outputPanel>
+
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{watermarkBean.attributes}"
id="attributes" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/AbstractWatermarkTest.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/AbstractWatermarkTest.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/AbstractWatermarkTest.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+
+import org.apache.commons.lang.Validate;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
+import org.richfaces.tests.metamer.bean.WatermarkBean;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+
+/**
+ * Abstract test case for pages faces/components/watermark/
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+abstract public class AbstractWatermarkTest extends AbstractMetamerTest {
+
+ private JQueryLocator watermarked;
+ private JQueryLocator output;
+
+ public void testInit() {
+ assertTrue(selenium.isVisible(getWatermarkedLocator()), "Watermarked field
is not on the page.");
+ assertTrue(selenium.isElementPresent(getOutputLocator()), "Output is not on
the page.");
+ assertEquals(getContent(getWatermarkedLocator()),
WatermarkBean.DEFAULT_WATERMARK_TEXT, "The default watermark text doesn't
match.");
+ }
+
+ public void testSelectWithKeyboard() {
+ selenium.focus(getWatermarkedLocator());
+ waitModel
+ .failWith("The watermark text should disappear when the watermarked
object is selected with keyboard. The value of the watermarked field is <" +
getContent(watermarked) + ">.")
+ .until(createContentCondition(getWatermarkedLocator(), ""));
+ removeFocus(selenium, getWatermarkedLocator());
+ waitModel
+ .failWith("After changing focus without typing any text, the default
watermark text should appear.")
+ .until(createContentCondition(getWatermarkedLocator(),
WatermarkBean.DEFAULT_WATERMARK_TEXT));
+ }
+
+ public void testSelectWithMouse() {
+ selenium.click(getWatermarkedLocator());
+ waitModel
+ .failWith("The watermark text should disappear when the watermarked
object is selected with mouse. The value of the watermarked field is <" +
getContent(watermarked) + ">.")
+ .until(createContentCondition(getWatermarkedLocator(), ""));
+// selenium.click(pjq("input[id$=valueInput]"));
+// waitModel
+// .failWith("After changing focus without typing any text, the default
watermark text should appear. The value of the watermarked field is <" +
getContent(getWatermarkedLocator()) + ">.")
+// .until(createContentCondition(getWatermarkedLocator(),
WatermarkBean.DEFAULT_WATERMARK_TEXT));
+ }
+
+ public void testFilling() {
+ selenium.type(getWatermarkedLocator(), "Alabama");
+ removeFocus(selenium, getWatermarkedLocator());
+ waitModel
+ .failWith("After typing any text to the watermarked field, the text
should stay there after changing focus. The value of the watermarked field is <" +
getContent(watermarked) + ">.")
+ .until(createContentCondition(getWatermarkedLocator(),
"Alabama"));
+ selenium.type(getWatermarkedLocator(), "");
+ removeFocus(selenium, getWatermarkedLocator());
+ waitModel
+ .failWith("After typing and deleting a text in the field, the default
watermark text should appear. It was <" + getContent(getWatermarkedLocator())
+">.")
+ .until(createContentCondition(getWatermarkedLocator(),
WatermarkBean.DEFAULT_WATERMARK_TEXT));
+ }
+
+ public void testAttributeRendered() {
+
selenium.click(pjq("input[type=radio][name*=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+ assertEquals(getContent(getWatermarkedLocator()), "", "Watermark
text should not be rendered when rendered=false.");
+ }
+
+ abstract protected JQueryLocator createWatermarkedLocator();
+
+ protected SeleniumCondition createContentCondition(final JQueryLocator locator, final
String content) {
+ Validate.notNull(locator);
+ Validate.notNull(content);
+ return new SeleniumCondition() {
+ @Override
+ public boolean isTrue() {
+ return getContent(locator).equals(content);
+ }
+ };
+ }
+
+ abstract protected String getContent(JQueryLocator locator);
+
+ protected JQueryLocator createOutputLocator() {
+ return pjq("div[id$=output]");
+ }
+
+ protected String getComponentPath() {
+ return "faces/components/watermark/";
+ }
+
+ protected JQueryLocator getOutputLocator() {
+ if (output == null) {
+ output = createOutputLocator();
+ }
+ return output;
+ }
+
+ protected JQueryLocator getWatermarkedLocator() {
+ if (watermarked == null) {
+ watermarked = createWatermarkedLocator();
+ }
+ return watermarked;
+ }
+
+ protected void removeFocus(AjaxSelenium selenium, JQueryLocator locator) {
+ selenium.fireEvent(watermarked, Event.BLUR);
+ }
+
+}
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputSecret.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputSecret.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputSecret.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/watermark/richSelect.xhtml.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestWatermarkInputSecret extends AbstractWatermarkTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, getComponentPath() + "richSelect.xhtml");
+ }
+
+ @Test
+ @Override
+ public void testInit() {
+ super.testInit();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithKeyboard() {
+ super.testSelectWithKeyboard();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithMouse() {
+ super.testSelectWithMouse();
+ }
+
+ @Test
+ @Override
+ public void testFilling() {
+ super.testFilling();
+ }
+
+ @Override
+ protected JQueryLocator createWatermarkedLocator() {
+ return pjq("input[id$=watermarkedInput]");
+ }
+
+ @Override
+ protected String getContent(JQueryLocator locator) {
+ return selenium.getValue(locator);
+ }
+
+}
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputText.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputText.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputText.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+/**
+ * Test case for page faces/components/watermark/hInputText.xhtml.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestWatermarkInputText extends AbstractWatermarkTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, getComponentPath() + "hInputText.xhtml");
+ }
+
+ @Test
+ @Override
+ public void testInit() {
+ super.testInit();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithKeyboard() {
+ super.testSelectWithKeyboard();
+ }
+
+ @Test
+ @Override
+ public void testFilling() {
+ super.testFilling();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithMouse() {
+ super.testSelectWithMouse();
+ }
+
+ @Override
+ protected JQueryLocator createWatermarkedLocator() {
+ return pjq("input[id$=watermarked]");
+ }
+
+ @Override
+ protected String getContent(JQueryLocator locator) {
+ return selenium.getValue(locator);
+ }
+
+}
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputTextArea.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputTextArea.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkInputTextArea.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/watermark/hInputTextArea.xhtml.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestWatermarkInputTextArea extends AbstractWatermarkTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, getComponentPath() +
"hInputTextArea.xhtml");
+ }
+
+ @Test
+ @Override
+ public void testInit() {
+ super.testInit();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithKeyboard() {
+ super.testSelectWithKeyboard();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithMouse() {
+ super.testSelectWithMouse();
+ }
+
+ @Test
+ @Override
+ public void testFilling() {
+ super.testFilling();
+ }
+
+ @Override
+ protected JQueryLocator createWatermarkedLocator() {
+ return pjq("textarea[id$=watermarked]");
+ }
+
+ @Override
+ protected String getContent(JQueryLocator locator) {
+ return selenium.getValue(locator);
+ }
+}
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichAutocomplete.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichAutocomplete.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichAutocomplete.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/watermark/richAutocomplete.xhtml.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestWatermarkRichAutocomplete extends AbstractWatermarkTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, getComponentPath() +
"richAutocomplete.xhtml");
+ }
+
+ @Test
+ @Override
+ public void testInit() {
+ super.testInit();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithKeyboard() {
+ super.testSelectWithKeyboard();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithMouse() {
+ super.testSelectWithMouse();
+ }
+
+ @Test
+ @Override
+ public void testFilling() {
+ super.testFilling();
+ }
+
+ @Override
+ protected JQueryLocator createWatermarkedLocator() {
+ return pjq("input[id$=watermarkedInput]");
+ }
+
+ @Override
+ protected String getContent(JQueryLocator locator) {
+ return selenium.getValue(locator);
+ }
+}
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichCalendar.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichCalendar.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichCalendar.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
+import org.richfaces.tests.metamer.bean.WatermarkBean;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/watermark/richCalendar.xhtml.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestWatermarkRichCalendar extends AbstractWatermarkTest {
+
+ private JQueryLocator calendarButton = pjq("img.rf-cal-btn");
+ private JQueryLocator calendarCleanButton = pjq("td.rf-cal-tl-ftr:eq(1) >
div");
+ private JQueryLocator calendarTodayButton = pjq("td.rf-cal-tl-ftr:eq(4) >
div");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, getComponentPath() +
"richCalendar.xhtml");
+ }
+
+ @Test
+ @Override
+ public void testInit() {
+ super.testInit();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithKeyboard() {
+ super.testSelectWithKeyboard();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithMouse() {
+ super.testSelectWithMouse();
+ }
+
+ @Test
+ @Override
+ public void testFilling() {
+ super.testFilling();
+ }
+
+ @Test
+ public void testPickingDate() {
+ selenium.click(calendarButton);
+ selenium.click(calendarTodayButton);
+ waitModel
+ .failWith("The calendar's today button doesn't work. The value
of the watermarked field is <" + getContent(getWatermarkedLocator()) +
">.")
+ .until(new SeleniumCondition() {
+ @Override
+ public boolean isTrue() {
+ return !getContent(getWatermarkedLocator()).equals("")
&&
!getContent(getWatermarkedLocator()).equals(WatermarkBean.DEFAULT_WATERMARK_TEXT);
+ }
+ });
+ }
+
+ @Test
+ public void testClean() {
+ selenium.click(calendarButton);
+ selenium.click(calendarTodayButton);
+ selenium.click(calendarButton);
+ selenium.click(calendarCleanButton);
+ waitModel
+ .failWith("After clicking on the clean button the watermark text should
appear. The value of the watermarked field is <" +
getContent(getWatermarkedLocator()) + ">.")
+ .until(createContentCondition(getWatermarkedLocator(),
WatermarkBean.DEFAULT_WATERMARK_TEXT));
+ }
+
+ @Override
+ protected JQueryLocator createWatermarkedLocator() {
+ return pjq("input[id$=watermarkedInputDate]");
+ }
+
+ @Override
+ protected String getContent(JQueryLocator locator) {
+ return selenium.getValue(locator);
+ }
+}
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichSelect.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichSelect.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/watermark/TestWatermarkRichSelect.java 2011-07-20
10:21:07 UTC (rev 22557)
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * 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.watermark;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.bean.WatermarkBean;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/watermark/richSelect.xhtml.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestWatermarkRichSelect extends AbstractWatermarkTest {
+
+ private JQueryLocator selectButton = pjq("span.rf-sel-btn");
+ private JQueryLocator selectPopup = jq("div.rf-sel-lst-cord");
+ private JQueryLocator selectPopupAlabama =
jq("div[id$=watermarkedItem0]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, getComponentPath() + "richSelect.xhtml");
+ }
+
+ @Test
+ @Override
+ public void testInit() {
+ super.testInit();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithKeyboard() {
+ super.testSelectWithKeyboard();
+ }
+
+ @Test
+ @Override
+ public void testSelectWithMouse() {
+ super.testSelectWithMouse();
+ }
+
+ @Test
+ @Override
+ public void testFilling() {
+ super.testFilling();
+ }
+
+ @Test
+ public void testPopup() {
+ selenium.mouseDown(selectButton);
+ selenium.mouseUp(selectButton);
+ assertTrue(selenium.isVisible(selectPopup), "After clicking on the arrow
button, the popup list should appear.");
+ assertTrue(selenium.isElementPresent(selectPopupAlabama), "After clicking on
the arrow button, the popup list should contains all items.");
+ }
+
+ @Test
+ public void testSelectItem() {
+ // HACK: only one couple moused down and up should be present
+ selenium.mouseDown(selectButton);
+ selenium.mouseUp(selectButton);
+ selenium.mouseDown(selectButton);
+ selenium.mouseUp(selectButton);
+ selenium.mouseDown(selectButton);
+ selenium.mouseUp(selectButton);
+
+ selenium.click(selectPopupAlabama);
+ waitModel
+ .failWith("Selecting item from popup list doesn't work. The value of
the watermarked field is <" + getContent(getWatermarkedLocator()) +
">.")
+ .until(createContentCondition(getWatermarkedLocator(),
"Alabama"));
+
+ selenium.type(getWatermarkedLocator(), "");
+ selenium.fireEvent(getWatermarkedLocator(), Event.BLUR);
+ waitModel
+ .failWith("After selecting item from popup list and deleting text in the
field, the watermark text should appear. The value of the watermarked field is <"
+ getContent(getWatermarkedLocator()) + ">.")
+ .until(createContentCondition(getWatermarkedLocator(),
WatermarkBean.DEFAULT_WATERMARK_TEXT));
+
+ assertTrue(selenium.belongsClass(getWatermarkedLocator(),
"rf-sel-dflt-lbl"), "After selecting item from popup list and deleting text
in the field, the field should belong to the css class <rf-sel-dflt-lbl>.");
+ }
+
+ @Override
+ protected JQueryLocator createWatermarkedLocator() {
+ return pjq("input[id$=watermarkedInput]");
+ }
+
+ @Override
+ protected String getContent(JQueryLocator locator) {
+ return selenium.getValue(locator);
+ }
+}
+
\ No newline at end of file