Author: jpapouse
Date: 2011-09-15 08:49:56 -0400 (Thu, 15 Sep 2011)
New Revision: 22722
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java
Log:
RFPL-1138 (drop target): added test for attributes onbegin, onbeforedomupdate and
oncomplete
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java 2011-09-15
11:59:57 UTC (rev 22721)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java 2011-09-15
12:49:56 UTC (rev 22722)
@@ -25,21 +25,17 @@
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
*/
public class DropTargetAttributes extends AbstractComponentAttributes {
public void setAcceptedTypes(String acceptedTypes) {
setProperty("acceptedTypes", acceptedTypes);
}
- public void setRender(String render) {
- setProperty("render", render);
- }
+ public void setBypassUpdates(Boolean bypassUpdates) {
+ setProperty("bypassUpdates", bypassUpdates);
+ }
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
public void setExecute(String execute) {
setProperty("execute", execute);
}
@@ -48,7 +44,23 @@
setProperty("immediate", immediate);
}
- public void setBypassUpdates(Boolean bypassUpdates) {
- setProperty("bypassUpdates", bypassUpdates);
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ setProperty("onbeforedomupdate", onbeforedomupdate);
+ }
+
+ public void setOnbegin(String onbegin) {
+ setProperty("onbegin", onbegin);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ setProperty("oncomplete", oncomplete);
}
+
+ public void setRender(String render) {
+ setProperty("render", render);
+ }
+
+ public void setRendered(Boolean rendered) {
+ setProperty("rendered", rendered);
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java 2011-09-15
11:59:57 UTC (rev 22721)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java 2011-09-15
12:49:56 UTC (rev 22722)
@@ -41,8 +41,11 @@
import org.jboss.test.selenium.GuardRequest;
import org.jboss.test.selenium.actions.Drag;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
+import org.jboss.test.selenium.waiting.EventFiredCondition;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
import org.richfaces.tests.metamer.ftest.richDragIndicator.AbstractDragNDropTest;
@@ -188,6 +191,23 @@
phaseInfo.assertPhases(RESTORE_VIEW, APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS,
RENDER_RESPONSE);
}
+ @Test
+ public void testEvents() {
+ attributes.setOnbeforedomupdate("metamerEvents += \"beforedomupdate
\"");
+ attributes.setOnbegin("metamerEvents += \"begin \"");
+ attributes.setOncomplete("metamerEvents += \"complete \"");
+ selenium.getEval(new JavaScript("window.metamerEvents =
\"\";"));
+
+ testAcception(drg1, ACCEPTING);
+ guardedDrop(RequestType.XHR);
+
+ String[] events = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
+ assertEquals(events.length, 3, "3 events should be fired.");
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't
work");
+ assertEquals(events[1], "beforedomupdate", "Attribute
onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete
doesn't work");
+ }
+
private void testAcceptedDropping(Draggable draggable) {
testAcception(draggable, ACCEPTING);
Show replies by date