[richfaces-svn-commits] JBoss Rich Faces SVN: r11896 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/calendar and 1 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Thu Dec 18 14:29:01 EST 2008
Author: dsvyatobatsko
Date: 2008-12-18 14:29:00 -0500 (Thu, 18 Dec 2008)
New Revision: 11896
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/jointPointAndDirectionAttributesTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/CalendarTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5346
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/CalendarTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/CalendarTestBean.java 2008-12-18 18:43:01 UTC (rev 11895)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/CalendarTestBean.java 2008-12-18 19:29:00 UTC (rev 11896)
@@ -609,4 +609,40 @@
this.resetTimeOnDateSelect = resetTimeOnDateSelect;
}
+ private String jointPoint = "bottom-left";
+
+ /**
+ * Gets value of jointPoint field.
+ * @return value of jointPoint field
+ */
+ public String getJointPoint() {
+ return jointPoint;
+ }
+
+ /**
+ * Set a new value for jointPoint field.
+ * @param jointPoint a new value for jointPoint field
+ */
+ public void setJointPoint(String jointPoint) {
+ this.jointPoint = jointPoint;
+ }
+
+ private String direction = "bottom-right";
+
+ /**
+ * Gets value of direction field.
+ * @return value of direction field
+ */
+ public String getDirection() {
+ return direction;
+ }
+
+ /**
+ * Set a new value for direction field.
+ * @param direction a new value for direction field
+ */
+ public void setDirection(String direction) {
+ this.direction = direction;
+ }
+
}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/jointPointAndDirectionAttributesTest.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/jointPointAndDirectionAttributesTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-18 18:43:01 UTC (rev 11895)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-18 19:29:00 UTC (rev 11896)
@@ -69,6 +69,8 @@
static final String EVENTS_TEST_URL = "pages/calendar/testEventsAttributes.xhtml";
+ static final String JOINTPOINT_DIRECTION_TEST_URL = "pages/calendar/jointPointAndDirectionAttributesTest.xhtml";
+
static final String RESET_TIME_ON_DATE_SELECTION_TEST_URL = "pages/calendar/resetTimeOnDateSelectTest.xhtml";
static final String CONTROLS_FORM_ID = "_controls:";
@@ -180,6 +182,10 @@
String resetTimeOnDateSelectId;
+ String jointPointId;
+
+ String directionId;
+
void initIds(String parentId) {
calendarId = parentId + FORM_ID + "calendar";
calendarHeaderId = calendarId + "Header";
@@ -225,6 +231,8 @@
isDisabledId = parentId + FORM_ID + "isDisabled";
defaultTimeId = parentId + CONTROLS_FORM_ID + "defaultTime";
resetTimeOnDateSelectId = parentId + CONTROLS_FORM_ID + "resetTimeOnDateSelect";
+ jointPointId = parentId + FORM_ID + "jointPoint";
+ directionId = parentId + FORM_ID + "direction";
}
String getStatus() {
@@ -1556,6 +1564,66 @@
Assert.assertEquals(actualSelectedDate, expectedTodaySelectedDate);
}
+ @Test
+ public void testJointPointAndDirectionAttributes(Template template) {
+ renderPage(JOINTPOINT_DIRECTION_TEST_URL, template, null);
+ initIds(getParentId());
+
+ String calendarLeft = "$('" + calendarId + "').cumulativeOffset().left";
+ String calendarTop = "$('" + calendarId + "').cumulativeOffset().top";
+
+ String topLeftPointLeft = "$('" + inputDateId + "').cumulativeOffset().left";
+ String topLeftPointTop = "$('" + inputDateId + "').cumulativeOffset().top";
+
+ String bottomLeftPointLeft = topLeftPointLeft;
+ String bottomLeftPointTop = "($('" + inputDateId + "').cumulativeOffset().top + $('" + inputDateId + "').getHeight())";
+
+ String topRightPointLeft = "($('" + popupButtonId + "').cumulativeOffset().left + $('" + popupButtonId + "').getWidth())";
+ String topRightPointTop = "$('" + popupButtonId + "').cumulativeOffset().top";
+
+ String bottomRightPointLeft = topRightPointLeft;
+ String bottomRightPointTop = "($('" + popupButtonId + "').cumulativeOffset().top + $('" + popupButtonId + "').getHeight()))";
+
+ //point:
+ //"top-left"
+ //"top-right"
+ //"bottom-left"
+ //"bottom-right"
+ //waiteForCondition("$('" + popupButtonId + "').getStyle('display') != 'none'", 1000);
+
+ //top-left joint point
+ selenium.select(jointPointId, "top-left");
+
+ //top-left direction
+ selenium.select(directionId, "top-left");
+ showPopup();
+ assertTrue(calendarLeft, "<", topLeftPointLeft);
+ assertTrue(calendarTop, "<", topLeftPointTop);
+
+ //top-right direction
+ selenium.select(directionId, "top-right");
+ showPopup();
+ assertTrue(calendarLeft, "==", topLeftPointLeft);
+ assertTrue(calendarTop, "<", topLeftPointTop);
+
+ //bottom-right direction
+ selenium.select(directionId, "bottom-right");
+ showPopup();
+ assertTrue(calendarLeft, "==", topLeftPointLeft);
+ assertTrue(calendarTop, "==", topLeftPointTop);
+
+ //bottom-left direction
+ selenium.select(directionId, "bottom-left");
+ showPopup();
+ assertTrue(calendarLeft, "<", topLeftPointLeft);
+ assertTrue(calendarTop, "==", topLeftPointTop);
+ }
+
+ private void assertTrue(String calendarPoint, String operation, String jointPoint) {
+ Assert.assertTrue(Boolean.parseBoolean(selenium.getEval(WINDOW_JS_RESOLVER + calendarPoint + " " + operation
+ + " " + WINDOW_JS_RESOLVER + jointPoint)), runScript(calendarPoint) + operation + runScript(jointPoint));
+ }
+
private void setPopup(boolean isPopup) {
runScript("$('" + isPopupId + "').checked=" + isPopup);
}
More information about the richfaces-svn-commits
mailing list