Author: jpapouse
Date: 2011-09-15 09:32:21 -0400 (Thu, 15 Sep 2011)
New Revision: 22723
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
Log:
RFPL-1139 (attach queue): added test for onrequestqueue and onrequestdequeue attributes
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-15
12:49:56 UTC (rev 22722)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-15
13:32:21 UTC (rev 22723)
@@ -28,8 +28,10 @@
import static
org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
import static
org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
import static
org.richfaces.tests.metamer.ftest.attributes.AttributeList.queueAttributes;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import java.io.InputStream;
import java.net.URL;
import org.jboss.cheiron.halt.XHRHalter;
@@ -130,4 +132,21 @@
queue.checkTimes(0);
assertFalse(selenium.isAlertPresent());
}
+
+ @Test
+ public void testQueueAndDequeueEvents() {
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
+ attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, 0);
+
+ attachQueueAttrs1.set(AttachQueueAttributes.onrequestqueue, "metamerEvents
+= \"requestqueue \"");
+ attachQueueAttrs1.set(AttachQueueAttributes.onrequestdequeue, "metamerEvents
+= \"requestdequeue \"");
+ selenium.getEval(new JavaScript("window.metamerEvents =
\"\";"));
+
+ queue.fireEvent(Input.FIRST, 1);
+
+ String[] events = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
+ assertEquals(events.length, 2, "2 events should be fired, was [" +
selenium.getEval(new JavaScript("window.metamerEvents")) + "]");
+ assertEquals(events[0], "requestqueue", "Attribute onrequestqueue
doesn't work");
+ assertEquals(events[1], "requestdequeue", "Attribute
onrequestdequeue doesn't work");
+ }
}
\ No newline at end of file
Show replies by date