Author: jjamrich
Date: 2012-01-24 05:52:35 -0500 (Tue, 24 Jan 2012)
New Revision: 23179
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/TestRichContextMenu.java
Log:
RF-10197: add test for @verticalOffset for rich:contextMenu
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/TestRichContextMenu.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/TestRichContextMenu.java 2012-01-24
09:12:58 UTC (rev 23178)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/TestRichContextMenu.java 2012-01-24
10:52:35 UTC (rev 23179)
@@ -34,6 +34,7 @@
import java.net.URL;
+import org.jboss.test.selenium.css.CssProperty;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.geometry.Point;
import org.jboss.test.selenium.locator.Attribute;
@@ -75,7 +76,7 @@
private void clickOnTarget(JQueryLocator target) {
// mouseDownRight doesn't work, so have to use left click for common cases
- contextMenuAttributes.set(showEvent, "click");
+ contextMenuAttributes.set(showEvent, Event.CLICK);
Point position = selenium.getElementPosition(target);
selenium.clickAt(target, position.minus(new Point(0, 70)));
@@ -173,7 +174,7 @@
@Test
public void testMode() {
- contextMenuAttributes.set(showEvent, "click");
+ contextMenuAttributes.set(showEvent, Event.CLICK);
Point position = selenium.getElementPosition(menuElem);
// ajax
@@ -214,7 +215,7 @@
@Test
public void testOnhide() {
contextMenuAttributes.set(hideDelay, "20");
- // contextMenuAttributes.set(showEvent, "click");
+ // contextMenuAttributes.set(showEvent, Event.CLICK);
String value = "metamerEvents += \"hide\"";
ElementLocator<?> eventInput = pjq("input[id$=onhideInput]");
@@ -336,9 +337,24 @@
assertEquals(selenium.getAttribute(contextMenu.getAttribute(Attribute.TITLE)),
titleVal);
}
- // @Test
+ @Test
public void testVerticalOffset() {
+ CssProperty cssTop = new CssProperty("top");
+ int offset = 11;
+ clickOnTarget(menuElem);
+ String offsetBefore = selenium.getStyle(contextMenuContent, cssTop);
+
+ contextMenuAttributes.set(verticalOffset, offset);
+ clickOnTarget(menuElem);
+
+ String offsetAfter = selenium.getStyle(contextMenuContent, cssTop);
+
+ // remove suffix "px"
+ int before = Integer.valueOf(offsetBefore.substring(0,
offsetBefore.length()-2));
+ int after = Integer.valueOf(offsetAfter.substring(0, offsetAfter.length()-2));
+
+ assertEquals(after, before - offset);
}
}
Show replies by date