JBoss Rich Faces SVN: r11420 - trunk/ui/dataTable/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-27 14:34:54 -0500 (Thu, 27 Nov 2008)
New Revision: 11420
Modified:
trunk/ui/dataTable/src/test/java/org/richfaces/component/AbstractColumnComponentTest.java
Log:
Reset ValueExpression before call setValue method
Modified: trunk/ui/dataTable/src/test/java/org/richfaces/component/AbstractColumnComponentTest.java
===================================================================
--- trunk/ui/dataTable/src/test/java/org/richfaces/component/AbstractColumnComponentTest.java 2008-11-27 19:29:11 UTC (rev 11419)
+++ trunk/ui/dataTable/src/test/java/org/richfaces/component/AbstractColumnComponentTest.java 2008-11-27 19:34:54 UTC (rev 11420)
@@ -82,11 +82,19 @@
public void testSettersAndGetters() throws Exception {
column.setValueExpression("sortOrder", new MockValueExpression(Ordering.ASCENDING));
assertEquals(Ordering.ASCENDING, column.getSortOrder());
+
+ // reset value expression
+ column.setValueExpression("sortOrder", null);
+
column.setSortOrder(Ordering.DESCENDING);
assertEquals(Ordering.DESCENDING, column.getSortOrder());
column.setValueExpression("filterValue", new MockValueExpression(null));
assertNull(column.getFilterValue());
+
+ // reset value expression
+ column.setValueExpression("filterValue", null);
+
column.setFilterValue("filterValue");
assertEquals("filterValue", column.getFilterValue());
}
16 years, 3 months
JBoss Rich Faces SVN: r11419 - trunk/framework/test/src/main/java/org/ajax4jsf/tests.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-27 14:29:11 -0500 (Thu, 27 Nov 2008)
New Revision: 11419
Modified:
trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockValueExpression.java
Log:
https://jira.jboss.org/jira/browse/RF-5119
Modified: trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockValueExpression.java
===================================================================
--- trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockValueExpression.java 2008-11-27 19:28:11 UTC (rev 11418)
+++ trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockValueExpression.java 2008-11-27 19:29:11 UTC (rev 11419)
@@ -36,15 +36,18 @@
*
*/
public class MockValueExpression extends ValueExpression {
+
+ private static final long serialVersionUID = -285020144243143376L;
- /** Object to returned by getValue method */
- private Object o;
-
+ /** Object to returned by getValue method */
+ private Object value;
+
/**
* TODO Description goes here.
*/
- public MockValueExpression(Object o) {
- this.o = o;
+ public MockValueExpression(Object value) {
+ super();
+ this.value = value;
}
/* (non-Javadoc)
@@ -52,8 +55,7 @@
*/
@Override
public Class<?> getExpectedType() {
- // TODO Auto-generated method stub
- return Object.class;
+ return Object.class;
}
/* (non-Javadoc)
@@ -61,8 +63,7 @@
*/
@Override
public Class<?> getType(ELContext context) {
- // TODO Auto-generated method stub
- return Object.class;
+ return value.getClass();
}
/* (non-Javadoc)
@@ -71,7 +72,7 @@
@Override
public Object getValue(ELContext context) {
// TODO Auto-generated method stub
- return o;
+ return value;
}
/* (non-Javadoc)
@@ -88,7 +89,7 @@
*/
@Override
public void setValue(ELContext context, Object value) {
- o = value;
+ value = value;
}
@@ -98,14 +99,14 @@
@Override
public String getExpressionString() {
// TODO Auto-generated method stub
- return o.toString();
+ return value.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((o == null) ? 0 : o.hashCode());
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@@ -118,10 +119,10 @@
if (getClass() != obj.getClass())
return false;
MockValueExpression other = (MockValueExpression) obj;
- if (o == null) {
- if (other.o != null)
+ if (value == null) {
+ if (other.value != null)
return false;
- } else if (!o.equals(other.o))
+ } else if (!value.equals(other.value))
return false;
return true;
}
16 years, 3 months
JBoss Rich Faces SVN: r11418 - in trunk/ui/pickList/src/test/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2008-11-27 14:28:11 -0500 (Thu, 27 Nov 2008)
New Revision: 11418
Modified:
trunk/ui/pickList/src/test/java/org/richfaces/component/PickListComponentTest.java
trunk/ui/pickList/src/test/java/org/richfaces/renderkit/PickListRendererTest.java
Log:
extend and fix tests
Modified: trunk/ui/pickList/src/test/java/org/richfaces/component/PickListComponentTest.java
===================================================================
--- trunk/ui/pickList/src/test/java/org/richfaces/component/PickListComponentTest.java 2008-11-27 18:07:04 UTC (rev 11417)
+++ trunk/ui/pickList/src/test/java/org/richfaces/component/PickListComponentTest.java 2008-11-27 19:28:11 UTC (rev 11418)
@@ -21,7 +21,6 @@
package org.richfaces.component;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -29,7 +28,6 @@
import javax.faces.component.UIForm;
import javax.faces.component.UISelectItem;
-import javax.faces.component.UISelectItems;
import javax.faces.component.html.HtmlForm;
import javax.faces.model.SelectItem;
@@ -39,18 +37,18 @@
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlScript;
+/**
+ * @author Anton Belevich
+ *
+ */
public class PickListComponentTest extends AbstractAjax4JsfTestCase{
UIForm form;
UIPickList pickList;
- String [] selected = new String [] {"District of Columbia,Illinois,Maryland,New Hampshire,New Jersey"};
-
- private static Set javaScripts = new HashSet();
-
- List selectItems = new ArrayList();
-
+ private static Set <String> javaScripts = new HashSet<String>();
+
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
@@ -75,17 +73,9 @@
form = new HtmlForm();
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
-
+
pickList = (UIPickList)application.createComponent("org.richfaces.PickList");
- pickList.setValue(selected);
- selectItems.add(new SelectItem("District of Columbia"));
- selectItems.add(new SelectItem("Illinois"));
- selectItems.add(new SelectItem("Maryland"));
- selectItems.add(new SelectItem("Nevada"));
- selectItems.add(new SelectItem("New Hampshire"));
- selectItems.add(new SelectItem("New Jersey"));
-
UISelectItem item1 = new UISelectItem();
item1.setValue(new SelectItem("Oregon"));
@@ -102,9 +92,7 @@
pickList.getChildren().add(item2);
pickList.getChildren().add(item3);
pickList.getChildren().add(item4);
-
- UISelectItems items = new UISelectItems();
- items.setValue(selectItems);
+
form.getChildren().add(pickList);
}
@@ -117,18 +105,18 @@
HtmlPage page = renderView();
assertNotNull(page);
- List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
- for (Iterator it = scripts.iterator(); it.hasNext();) {
+ List <HtmlScript>scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName("script");
+ for (Iterator <HtmlScript> it = scripts.iterator(); it.hasNext();) {
HtmlScript item = (HtmlScript) it.next();
String srcAttr = item.getSrcAttribute();
- if (item.getFirstChild() != null) {
- String scriptBodyString = item.getFirstChild().toString();
+ if (item.getFirstDomChild() != null) {
+ String scriptBodyString = item.getFirstDomChild().getNodeValue();
assert(scriptBodyString.contains("Richfaces.PickList"));
}
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ for (Iterator <String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
String src = (String) srcIt.next();
found = srcAttr.contains(src);
if (found) {
@@ -140,15 +128,10 @@
}
}
+
public void tearDown() throws Exception {
- // TODO Auto-generated method stub
form = null;
pickList = null;
super.tearDown();
}
-
- public void testComponent() {
- assertTrue( true );
- }
-
}
Modified: trunk/ui/pickList/src/test/java/org/richfaces/renderkit/PickListRendererTest.java
===================================================================
--- trunk/ui/pickList/src/test/java/org/richfaces/renderkit/PickListRendererTest.java 2008-11-27 18:07:04 UTC (rev 11417)
+++ trunk/ui/pickList/src/test/java/org/richfaces/renderkit/PickListRendererTest.java 2008-11-27 19:28:11 UTC (rev 11418)
@@ -21,11 +21,11 @@
package org.richfaces.renderkit;
-import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.Arrays;
import java.util.List;
-import java.util.Set;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UISelectItem;
import javax.faces.component.UISelectItems;
@@ -33,8 +33,8 @@
import javax.faces.model.SelectItem;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockValueExpression;
import org.richfaces.component.UIPickList;
-import org.richfaces.renderkit.html.PickListRendererGen;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -48,53 +48,22 @@
private UIForm form;
private UIPickList pickList;
private UIPickList pickList2;
- private String [] selected = new String [] {"District of Columbia,Illinois,Maryland,New Hampshire,New Jersey"};
- private List selectedList = new ArrayList();
- private static Set javaScripts = new HashSet();
- private PickListRendererGen renderer;
-
- List selectItems = new ArrayList();
-
-
- static {
- javaScripts.add("a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/ShuttleUtils.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/SelectItem.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/PickListSI.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/LayoutManager.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/Control.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/ListBase.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/OrderingList.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/ListShuttle.js");
- javaScripts.add("a4j_3_2_0-SNAPSHOTscripts/PickList.js");
- }
-
+ private String [] selected = new String [] {"District of Columbia, Illinois, Maryland, New Hampshire, New Jersey"};
+ private List <String> selectedList = Arrays.asList(selected);
+ private List <SelectItem> selectItems = Arrays.asList(new SelectItem("New Mexico"), new SelectItem("Texas"), new SelectItem("Florida"));
+
+
public PickListRendererTest(String name) {
super(name);
- selectedList.add("District of Columbia");
- selectedList.add("Illinois");
- selectedList.add("Maryland");
- selectedList.add("New Hampshire");
- selectedList.add("New Jersey");
+
}
public void setUp() throws Exception {
super.setUp();
- renderer = new PickListRendererGen();
form = new HtmlForm();
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- pickList = (UIPickList)application.createComponent("org.richfaces.PickList");
- pickList.setValue(selected);
-
- selectItems.add(new SelectItem("District of Columbia"));
- selectItems.add(new SelectItem("Illinois"));
- selectItems.add(new SelectItem("Maryland"));
- selectItems.add(new SelectItem("Nevada"));
- selectItems.add(new SelectItem("New Hampshire"));
- selectItems.add(new SelectItem("New Jersey"));
-
UISelectItem item1 = new UISelectItem();
item1.setValue(new SelectItem("Oregon"));
@@ -106,45 +75,41 @@
UISelectItem item4 = new UISelectItem();
item4.setValue(new SelectItem("South Carolina"));
-
+
+ UISelectItems items = new UISelectItems();
+ items.setValue(selectItems);
+
+ pickList = (UIPickList)application.createComponent("org.richfaces.PickList");
+ pickList.setValueExpression("value", new MockValueExpression(selected) );
+
pickList.getChildren().add(item1);
pickList.getChildren().add(item2);
pickList.getChildren().add(item3);
pickList.getChildren().add(item4);
-
- UISelectItems items = new UISelectItems();
- items.setValue(selectItems);
+ pickList.getChildren().add(items);
form.getChildren().add(pickList);
pickList2 = (UIPickList)application.createComponent("org.richfaces.PickList");
- pickList2.setValue(selectedList);
- pickList2.getChildren().add(item1);
+ pickList2.setValueExpression("value", new MockValueExpression(selectedList) );
+ pickList2.getChildren().add(item1);
pickList2.getChildren().add(item2);
pickList2.getChildren().add(item3);
pickList2.getChildren().add(item4);
+ pickList2.getChildren().add(items);
+
form.getChildren().add(pickList2);
}
- public void testRender(){
-
- try {
- HtmlPage page = renderView();
- assertNotNull(page);
- HtmlElement elem = page.getHtmlElementById(pickList.getClientId(facesContext));
- assertNotNull(elem);
- assertEquals(elem.getTagName(), "table");
- renderer.doEncodeEnd(writer, facesContext, pickList);
-
- HtmlElement elem2 = page.getHtmlElementById(pickList2.getClientId(facesContext));
- assertNotNull(elem2);
- assertEquals(elem.getTagName(), "table");
- renderer.doEncodeEnd(writer, facesContext, pickList);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- fail();
- }
+ public void testRender() throws Exception{
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ HtmlElement elem = page.getHtmlElementById(pickList.getClientId(facesContext));
+ assertNotNull(elem);
+ assertEquals(elem.getTagName(), "table");
+ // TODO: extend mockup check test
+ HtmlElement elem2 = page.getHtmlElementById(pickList2.getClientId(facesContext));
+ assertNotNull(elem2);
+ assertEquals(elem.getTagName(), "table");
}
16 years, 3 months
JBoss Rich Faces SVN: r11417 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/tree and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-11-27 13:07:04 -0500 (Thu, 27 Nov 2008)
New Revision: 11417
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/images/tree/favorites.gif
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4818
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/images/tree/favorites.gif
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/images/tree/favorites.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-27 17:07:11 UTC (rev 11416)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-27 18:07:04 UTC (rev 11417)
@@ -341,7 +341,7 @@
private void testIcon(String location, String iconSubstring) {
String iconSrc = selenium.getAttribute(location + "/@src");
if (null == iconSrc || !iconSrc.matches(".*" + iconSubstring + ".*")) {
- Assert.fail("It looks as if the icon is not proper. Uri of icon is being tested must contain [" + iconSubstring + "] icon is expected");
+ Assert.fail("It looks as if the icon is not proper. Uri of icon is being tested must contain [" + iconSubstring + "]");
}
}
@@ -448,6 +448,21 @@
tester.checkNodeExpandedListener(false);
}
+ @Test
+ public void testNodePresentationCanBeCustomizedUsingRenderedAndNodeFaceAttributes(Template template) {
+ renderPage(template, null);
+ writeStatus("Check node presentation can be customized using rendered and nodeFace attributes");
+
+ String compId = getParentId() + "_form:tree";
+ writeStatus("Bretney is not my favourite singer (I don't even know how it spells). Check it");
+ testIcon("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td[2]/img", "singer");
+ AssertTextEquals("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td[3]", "Britney Spears");
+
+ writeStatus("Christina is my favourite one. Test it");
+ testIcon("//*[@id='"+ compId + ":childs']/table[2]/tbody/tr/td[2]/img", "favorite");
+ AssertTextEquals("//*[@id='"+ compId + ":childs']/table[2]/tbody/tr/td[3]", "Christina Aguilera [Oh, Lord! She's my favorite]");
+ }
+
@Override
public void sendAjax() {
AutoTester tester = getAutoTester(this);
16 years, 3 months
JBoss Rich Faces SVN: r11416 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-27 12:07:11 -0500 (Thu, 27 Nov 2008)
New Revision: 11416
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
Log:
RF-5011
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml 2008-11-27 16:39:42 UTC (rev 11415)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml 2008-11-27 17:07:11 UTC (rev 11416)
@@ -41,6 +41,7 @@
</rich:message>
</h:panelGroup>
<a4j:commandButton id="submit" value="Submit" reRender="panel"></a4j:commandButton>
+ <a4j:commandButton id="submitWithoutReRender" value="submitWithoutReRender"></a4j:commandButton>
</h:form>
</ui:define>
</ui:composition>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java 2008-11-27 16:39:42 UTC (rev 11415)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java 2008-11-27 17:07:11 UTC (rev 11416)
@@ -28,6 +28,18 @@
}
/**
+ * ajaxRendered message output first message for attached component by ajax request
+ */
+ @Test
+ public void testAjaxRendered(Template template) {
+ init(template);
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":passedMarker"));
+ selenium.type(inputText, "fatal");
+ clickAjaxCommandAndWait(mainForm + ":submitWithoutReRender");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":fatalMarker"));
+ }
+
+ /**
* check markers rendering
*/
@Test
16 years, 3 months
JBoss Rich Faces SVN: r11415 - in trunk/test-applications/seamApp/web/src/main: webapp/Editor and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2008-11-27 11:39:42 -0500 (Thu, 27 Nov 2008)
New Revision: 11415
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/editor/Editor.java
trunk/test-applications/seamApp/web/src/main/webapp/Editor/Editor.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/Editor/EditorProperty.xhtml
Log:
changes in editor (seam text)
Modified: trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/editor/Editor.java
===================================================================
--- trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/editor/Editor.java 2008-11-27 16:37:04 UTC (rev 11414)
+++ trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/editor/Editor.java 2008-11-27 16:39:42 UTC (rev 11415)
@@ -12,6 +12,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.richfaces.component.html.HtmlEditor;
+import org.richfaces.convert.seamtext.DefaultSeamTextConverter;
import org.richfaces.helloworld.domain.util.componentInfo.ComponentInfo;
;
@@ -39,7 +40,10 @@
// private String skin;
public Editor() {
- value = "It's easy to make *bold text*, /italic text/, |monospace|,-deleted text-, super^scripts^ or _underlines_.";
+ // value = "It's easy to make *emphasis*, |monospace|, ~deleted text~,
+ // super^scripts^ or _underlines_.";
+ // value = "This is a |<tag attribute=\"value\" />| example.";
+ value = "Collaboration-oriented websites require a human-friendly markup language for easy entry of formatted text in forum posts, wiki pages, blogs, comments, etc. Seam provides the <s:formattedText/> control for display of formatted text that conforms to the Seam Text language. Seam Text is implemented using an ANTLR-based parser. You don't need to know anything about ANTLR to use it, however.";
width = "400";
height = "200";
theme = "simple";
@@ -47,7 +51,7 @@
immediate = false;
rendered = true;
required = false;
- useSeamText = true;
+ useSeamText = false;
viewMode = "visual";
readonly = false;
tabindex = "1";
@@ -58,17 +62,6 @@
}
/*
- * delete custom converter
- */
- public void useSeamTextLis(ValueChangeEvent e) {
-// if (useSeamText) {
-// htmlEditor.setConverter(convert);
-// } else {
-// htmlEditor.setConverter(null);
-// }
- }
-
- /*
* attach config file to editor
*/
public void useConfigFile(ValueChangeEvent e) {
@@ -89,39 +82,39 @@
/*
* Custom Converter for editor
*/
-// private Converter convert = new Converter() {
-// public Object getAsObject(FacesContext context, UIComponent component,
-// String newValue) throws ConverterException {
-//
-// System.out.println("!!! getAsObject work !!!");
-//
-// if (false)
-// throw new ConverterException(new FacesMessage(
-// FacesMessage.SEVERITY_ERROR, "Converter error",
-// "Error while convert to Object"));
-//
-// return newValue;
-// }
-//
-// public String getAsString(FacesContext context, UIComponent component,
-// Object value) throws ConverterException {
-//
-// System.out.println("!!! getAsString work !!!");
-//
-// if (false)
-// throw new ConverterException(new FacesMessage(
-// FacesMessage.SEVERITY_ERROR, "Converter error",
-// "Error while convert to String"));
-//
-// String result = (value == null) ? "" : value.toString();
-// return result;
-// }
-// };
+ private Converter convert = new Converter() {
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String newValue) throws ConverterException {
-// public Converter getConvert() {
-// return convert;
-// }
+ System.out.println("!!! getAsObject work !!!");
+ if (false)
+ throw new ConverterException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Converter error",
+ "Error while convert to Object"));
+
+ return newValue;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) throws ConverterException {
+
+ System.out.println("!!! getAsString work !!!");
+
+ if (false)
+ throw new ConverterException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Converter error",
+ "Error while convert to String"));
+
+ String result = (value == null) ? "" : value.toString();
+ return result;
+ }
+ };
+
+ public Converter getConvert() {
+ return convert;
+ }
+
/*
* Custom Validator for Editor
*/
Modified: trunk/test-applications/seamApp/web/src/main/webapp/Editor/Editor.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Editor/Editor.xhtml 2008-11-27 16:37:04 UTC (rev 11414)
+++ trunk/test-applications/seamApp/web/src/main/webapp/Editor/Editor.xhtml 2008-11-27 16:39:42 UTC (rev 11415)
@@ -11,11 +11,10 @@
height="#{editor.height}" theme="#{editor.theme}"
onchange="#{event.onchange}" oninit="#{event.oninit}"
onsave="#{event.onsave}" onsetup="#{event.onsetup}"
- autoResize="#{editor.autoResize}" converterMessage="converterMessage"
- immediate="#{editor.immediate}" rendered="#{editor.rendered}"
- required="#{editor.required}" requiredMessage="requiredMessage"
- useSeamText="#{editor.useSeamText}" validator="#{editor.validate}"
- validatorMessage="validatorMessage"
+ autoResize="#{editor.autoResize}" immediate="#{editor.immediate}"
+ rendered="#{editor.rendered}" required="#{editor.required}"
+ requiredMessage="requiredMessage" useSeamText="#{editor.useSeamText}"
+ validator="#{editor.validate}" validatorMessage="validatorMessage"
valueChangeListener="#{editor.valueChangeListener}"
viewMode="#{editor.viewMode}" readonly="#{editor.readonly}"
tabindex="#{editor.tabindex}" dialogType="#{editor.dialogType}"
@@ -26,11 +25,11 @@
</rich:editor>
<h:panelGrid columns="1">
- <f:facet name="header">
- <h:outputText value="Results" />
- </f:facet>
+ <div style="color: red; font-style: italic">Bean Value (escape
+ = false):</div>
<h:outputText value="#{editor.value}" escape="false" />
- <div style="color: red; font-style: italic">HTML code:</div>
+ <div style="color: red; font-style: italic">Bean Value (escape
+ = true):</div>
<h:outputText value="#{editor.value}"
style="font-style: italic; color: gray" />
</h:panelGrid>
Modified: trunk/test-applications/seamApp/web/src/main/webapp/Editor/EditorProperty.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Editor/EditorProperty.xhtml 2008-11-27 16:37:04 UTC (rev 11414)
+++ trunk/test-applications/seamApp/web/src/main/webapp/Editor/EditorProperty.xhtml 2008-11-27 16:39:42 UTC (rev 11415)
@@ -39,7 +39,7 @@
<h:outputText value="useSeamText (work only with Seam libraries): "></h:outputText>
<h:selectBooleanCheckbox value="#{editor.useSeamText}"
- valueChangeListener="#{editor.useSeamTextLis}" onchange="submit();" />
+ onchange="submit();" />
<h:outputText value="readonly: "></h:outputText>
<h:selectBooleanCheckbox value="#{editor.readonly}"
16 years, 3 months
JBoss Rich Faces SVN: r11414 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-11-27 11:37:04 -0500 (Thu, 27 Nov 2008)
New Revision: 11414
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
https://jira.jboss.org/jira/browse/RF-4470
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-11-27 12:48:18 UTC (rev 11413)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-11-27 16:37:04 UTC (rev 11414)
@@ -326,8 +326,8 @@
if (isLast)
{
_this.doFinish();
- _this = undefined;
}
+ _this = undefined;
}, 0);
} else
{
16 years, 3 months
JBoss Rich Faces SVN: r11413 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/message and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-27 07:48:18 -0500 (Thu, 27 Nov 2008)
New Revision: 11413
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/MessageBean2.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
Log:
RF-5013
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/MessageBean2.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/MessageBean2.java 2008-11-27 12:44:24 UTC (rev 11412)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/MessageBean2.java 2008-11-27 12:48:18 UTC (rev 11413)
@@ -12,6 +12,8 @@
static public final String MESSAGE = "Validation is failed";
private String string;
+
+ private Boolean rendered;
public MessageBean2() {
@@ -19,6 +21,7 @@
public void init() {
string = "something";
+ rendered = true;
}
public void validate(FacesContext context, UIComponent component,
@@ -47,5 +50,13 @@
public String getString() {
return string;
}
+
+ public void setRendered(Boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public Boolean getRendered() {
+ return rendered;
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml 2008-11-27 12:44:24 UTC (rev 11412)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml 2008-11-27 12:48:18 UTC (rev 11413)
@@ -11,10 +11,18 @@
</ui:define>
<ui:define name="component">
+ <h:form id="attrForm">
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox id="rendered" value="#{messageBean.rendered}">
+ <a4j:support event="onchange" />
+ </h:selectBooleanCheckbox>
+ </h:form>
<h:form id="mainForm">
<h:panelGroup id="panel">
<h:inputText id="inputText" value="#{messageBean.string}" validator="#{messageBean.validate}"></h:inputText>
- <rich:message for="inputText">
+ <rich:message id="message" for="inputText"
+ rendered="#{messageBean.rendered}"
+ >
<f:facet name="fatalMarker">
<h:outputText id="fatalMarker" value="fatalMarker"></h:outputText>
</f:facet>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java 2008-11-27 12:44:24 UTC (rev 11412)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java 2008-11-27 12:48:18 UTC (rev 11413)
@@ -2,6 +2,7 @@
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
import org.testng.annotations.Test;
public class MessageTest extends SeleniumTestBase {
@@ -10,13 +11,20 @@
private String inputText;
+ private String message;
+
private String submit;
+ private String rendered;
+
private void init(Template template) {
renderPage(template, "#{messageBean.init}");
mainForm = getParentId() + "mainForm";
inputText = mainForm + ":inputText";
+ message = mainForm + ":message";
submit = mainForm + ":submit";
+ String attrForm = getParentId() + "attrForm";
+ rendered = attrForm + ":rendered";
}
/**
@@ -25,22 +33,37 @@
@Test
public void testMarkers(Template template) {
init(template);
- selenium.isElementPresent(mainForm + ":passedMarker");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":passedMarker"));
selenium.type(inputText, "fatal");
clickAjaxCommandAndWait(submit);
- selenium.isElementPresent(mainForm + ":fatalMarker");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":fatalMarker"));
selenium.type(inputText, "error");
clickAjaxCommandAndWait(submit);
- selenium.isElementPresent(mainForm + ":errorMarker");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":errorMarker"));
selenium.type(inputText, "warn");
clickAjaxCommandAndWait(submit);
- selenium.isElementPresent(mainForm + ":warnMarker");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":warnMarker"));
selenium.type(inputText, "info");
clickAjaxCommandAndWait(submit);
- selenium.isElementPresent(mainForm + ":infoMarker");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":infoMarker"));
}
-
+ /**
+ * component with rendered = false is not present on the page
+ */
+ @Test
+ public void testRendered(Template template) {
+ init(template);
+ init(template);
+ Assert.assertTrue(selenium.isElementPresent(message), "ListShuttle must be rendered.");
+
+ selenium.click(rendered);
+ waitForAjaxCompletion();
+ clickAjaxCommandAndWait(submit);
+
+ Assert.assertFalse(selenium.isElementPresent(message), "ListShuttle mustn't be rendered.");
+ }
+
@Override
public String getTestUrl() {
return "pages/message/message.xhtml";
16 years, 3 months
JBoss Rich Faces SVN: r11412 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-27 07:44:24 -0500 (Thu, 27 Nov 2008)
New Revision: 11412
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
Log:
DnD Test
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2008-11-27 12:43:06 UTC (rev 11411)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2008-11-27 12:44:24 UTC (rev 11412)
@@ -41,7 +41,7 @@
return "c:/FFProfile";
}
- //@Test
+ @Test
public void testDragValue(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
@@ -57,7 +57,7 @@
}
- //@Test
+ @Test
public void testDropValue(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
@@ -75,7 +75,7 @@
testDropData();
}
- //@Test
+ @Test
public void testListeners(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
16 years, 3 months
JBoss Rich Faces SVN: r11411 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/dnd and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-27 07:43:06 -0500 (Thu, 27 Nov 2008)
New Revision: 11411
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDListener.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dnd/dndTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
Log:
RF-5020
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDBean.java 2008-11-27 12:20:46 UTC (rev 11410)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDBean.java 2008-11-27 12:43:06 UTC (rev 11411)
@@ -12,10 +12,14 @@
*/
public class DnDBean {
- public static final String DRAGLISTENER = "DragListener";
+ public static final String DRAGLISTENER = "DragListener,";
- public static final String DROPLISTENER = "DropListener";
+ public static final String DROPLISTENER = "DropListener,";
+ public static final String RICHDROPLISTENER = "RichDropListener,";
+
+ public static final String RICHDRAGLISTENER = "RichDragListener,";
+
private List<Framework> containerPHP;
private List<Framework> containerCF;
@@ -98,12 +102,12 @@
public void processDropMethod(DropEvent event) {
Dropzone dropzone = (Dropzone) event.getComponent();
moveFramework(event.getDragValue(), dropzone.getDropValue());
- status += getStatus() + DROPLISTENER;
+ status += DROPLISTENER;
}
public void processDragMethod(DragEvent event) {
event.getAcceptedTypes();
- status += getStatus() + DRAGLISTENER;
+ status += DRAGLISTENER;
dragValue = event.getDragValue();
dropValue = event.getDropValue();
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDListener.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDListener.java 2008-11-27 12:20:46 UTC (rev 11410)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DnDListener.java 2008-11-27 12:43:06 UTC (rev 11411)
@@ -25,6 +25,8 @@
// DropListener implementation
//
public void processDrag(DragEvent event) {
+ DnDBean bean = getDnDBean();
+ bean.setStatus(bean.getStatus() + DnDBean.RICHDRAGLISTENER);
}
//
@@ -32,7 +34,9 @@
//
public void processDrop(DropEvent event) {
Dropzone dropzone = (Dropzone) event.getComponent();
- getDnDBean().moveFramework(event.getDragValue(), dropzone.getDropValue());
+ DnDBean bean = getDnDBean();
+ bean.moveFramework(event.getDragValue(), dropzone.getDropValue());
+ bean.setStatus(bean.getStatus() + DnDBean.RICHDROPLISTENER);
}
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dnd/dndTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2008-11-27 12:20:46 UTC (rev 11410)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2008-11-27 12:43:06 UTC (rev 11411)
@@ -1,5 +1,9 @@
package org.richfaces.testng;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.ajax4jsf.bean.DnDBean;
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
@@ -19,6 +23,7 @@
String dnetDropZoneId;
String cfDropZoneId;
String itemsHolderId;
+ String resetButtonId;
void initIds(String parentId) {
statusId = parentId + FORMID + "status";
@@ -28,6 +33,7 @@
dnetDropZoneId = parentId + FORMID + "DNET";
cfDropZoneId = parentId + FORMID + "CF";
itemsHolderId = parentId + FORMID + DATAID;
+ resetButtonId = parentId + FORMID + DATAID + "reset";
}
@Override
@@ -35,50 +41,76 @@
return "c:/FFProfile";
}
- @Test
+ //@Test
public void testDragValue(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
DragAndDrop(0, phpDropZoneId);
- waitForAjaxCompletion();
assertDragValue("Flexible Ajax", phpDropZoneId);
DragAndDrop(1, dnetDropZoneId);
- waitForAjaxCompletion();
assertDragValue("AJAXEngine", dnetDropZoneId);
DragAndDrop(0, cfDropZoneId);
- waitForAjaxCompletion();
assertDragValue("ajaxCFC", cfDropZoneId);
}
- // @Test
+ //@Test
public void testDropValue(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
DragAndDrop(0, phpDropZoneId);
- waitForAjaxCompletion();
assertDropValue("PHP");
testDropData();
DragAndDrop(1, dnetDropZoneId);
- waitForAjaxCompletion();
assertDropValue("DNET");
testDropData();
DragAndDrop(0, cfDropZoneId);
- waitForAjaxCompletion();
assertDropValue("CF");
testDropData();
}
+ //@Test
+ public void testListeners(Template template) {
+ renderPage(template, RESET_METHOD);
+ initIds(getParentId());
+
+ DragAndDrop(0, phpDropZoneId);
+ assertListeners(DnDBean.RICHDRAGLISTENER, DnDBean.DRAGLISTENER, DnDBean.DROPLISTENER);
+
+ clickAjaxCommandAndWait(resetButtonId);
+
+ DragAndDrop(1, cfDropZoneId);
+ assertListeners(DnDBean.RICHDRAGLISTENER, DnDBean.DRAGLISTENER, DnDBean.RICHDROPLISTENER);
+
+
+ }
+
+ @Test
+ public void testEvents(Template template) {
+ renderPage(template, RESET_METHOD);
+ initIds(getParentId());
+
+ DragAndDrop(0, phpDropZoneId);
+ List<String> eventsExpected = new ArrayList<String>();
+
+ eventsExpected.add("ondragstart");
+ eventsExpected.add("ondragenter");
+ eventsExpected.add("ondragend");
+ eventsExpected.add("ondrop");
+ eventsExpected.add("ondropend");
+
+ assertEvents(eventsExpected);
+ }
-
void DragAndDrop(int itemNumber, String dropZoneId) {
selenium.dragAndDropToObject("id=" + itemsHolderId + itemNumber + ":item", "id=" + dropZoneId + "_body");
+ waitForAjaxCompletion();
}
void testDropData () {
@@ -104,8 +136,28 @@
AssertTextEquals(dropValueId, expectedValue, "Drop Value is incorrect");
}
+ void assertListeners(String ... listener ) {
+ String status = getStatusValue();
+ String s = status;
+ String sum = "";
+ for (String l : listener) {
+ if (status.indexOf(l) == -1) {
+ Assert.fail(l + " has been skipped");
+ }else {
+ s = s.replace(l, "");
+ }
+ sum += l;
+ }
+ if (s.length() > 0) {
+ Assert.fail("The following listener were called but shouldn't: " + s);
+ }
+ if (!status.equals(sum)) {
+ Assert.fail("Order of listeners call is incorrect. Should be: " + sum + ". But was : " + status);
+ }
+ }
+
String getStatusValue() {
- return getValueById(statusId);
+ return getTextById(statusId);
}
@Override
16 years, 3 months