[richfaces-svn-commits] JBoss Rich Faces SVN: r11927 - 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
Fri Dec 19 11:50:57 EST 2008


Author: dsvyatobatsko
Date: 2008-12-19 11:50:57 -0500 (Fri, 19 Dec 2008)
New Revision: 11927

Added:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/todayControlAndBoundaryDatesModesTest.xhtml
Removed:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/todayControlModeTest.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-5349

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-19 16:40:54 UTC (rev 11926)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/CalendarTestBean.java	2008-12-19 16:50:57 UTC (rev 11927)
@@ -646,4 +646,22 @@
         this.direction = direction;
     }
 
+    private String boundaryDatesMode = "inactive";
+
+    /**
+     * Gets value of boundaryDatesMode field.
+     * @return value of boundaryDatesMode field
+     */
+    public String getBoundaryDatesMode() {
+        return boundaryDatesMode;
+    }
+
+    /**
+     * Set a new value for boundaryDatesMode field.
+     * @param boundaryDatesMode a new value for boundaryDatesMode field
+     */
+    public void setBoundaryDatesMode(String boundaryDatesMode) {
+        this.boundaryDatesMode = boundaryDatesMode;
+    }
+
 }

Copied: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/todayControlAndBoundaryDatesModesTest.xhtml (from rev 11913, trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/todayControlModeTest.xhtml)
===================================================================
(Binary files differ)

Deleted: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/todayControlModeTest.xhtml
===================================================================
(Binary files differ)

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-19 16:40:54 UTC (rev 11926)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java	2008-12-19 16:50:57 UTC (rev 11927)
@@ -59,7 +59,7 @@
 
     static final String SHOW_ATTRIBURES_TEST_URL = "pages/calendar/showAttributesTest.xhtml";
 
-    static final String TODAY_CONTROL_MODE_URL = "pages/calendar/todayControlModeTest.xhtml";
+    static final String TODAY_CONTROL_AND_BOUNDARY_DATES_MODES_TEST_URL = "pages/calendar/todayControlAndBoundaryDatesModesTest.xhtml";
 
     static final String BUTTON_RELATED_TEST_URL = "pages/calendar/buttonRelatedAttributesTest.xhtml";
 
@@ -188,6 +188,8 @@
     
     String enableManualInputId;
 
+    String boundaryDatesModeId;
+
     void initIds(String parentId) {
         calendarId = parentId + FORM_ID + "calendar";
         calendarHeaderId = calendarId + "Header";
@@ -236,6 +238,7 @@
         jointPointId = parentId + FORM_ID + "jointPoint";
         directionId = parentId + FORM_ID + "direction";
         enableManualInputId = parentId + FORM_ID + "enableManualInput";
+        boundaryDatesModeId = parentId + FORM_ID + "boundaryDatesMode";
     }
 
     String getStatus() {
@@ -1340,7 +1343,7 @@
 
     @Test
     public void testTodayControlMode(Template template) {
-        renderPage(TODAY_CONTROL_MODE_URL, template, null);
+        renderPage(TODAY_CONTROL_AND_BOUNDARY_DATES_MODES_TEST_URL, template, null);
         initIds(getParentId());
 
         String datePattern = selenium.getText(getParentId() + FORM_ID + "datePattern");
@@ -1422,6 +1425,78 @@
     }
 
     @Test
+    public void testBoundaryDatesMode(Template template) {
+        renderPage(TODAY_CONTROL_AND_BOUNDARY_DATES_MODES_TEST_URL, template, null);
+        initIds(getParentId());
+        String selectedDateId = getParentId() + FORM_ID + "selectedDate";
+        String startDate = "02/21/2007 12:00";
+        String firstMarCellId = calendarId + "DayCell32";
+        String thirtyFirstJanCellId = calendarId + "DayCell3";
+        selenium.focus(selectedDateId);
+        setValueById(selectedDateId, startDate);
+        selenium.fireEvent(selectedDateId, "blur");
+
+        writeStatus("Check 'boundaryDatesMode' attribute");
+
+        writeStatus("Check 'inactive' (default) mode");
+        selenium.select(boundaryDatesModeId, "inactive");
+
+        String expectedSelectedDate = selenium.getValue(inputDateId);
+        String expectedCurrentDate = selenium.getText(currentDateHeaderXpath);
+
+        writeStatus("Click boundary cells. Nothing has to be changed");
+        clickById(firstMarCellId);
+        String actualSelectedDate = selenium.getValue(inputDateId);
+        String actualCurrentDate = selenium.getText(currentDateHeaderXpath);
+        Assert.assertEquals(actualCurrentDate, expectedCurrentDate, "Nothing has to be changed");
+        Assert.assertEquals(actualSelectedDate, expectedSelectedDate, "Nothing has to be changed");
+
+        clickById(thirtyFirstJanCellId);
+        actualSelectedDate = selenium.getValue(inputDateId);
+        actualCurrentDate = selenium.getText(currentDateHeaderXpath);
+        Assert.assertEquals(actualCurrentDate, expectedCurrentDate, "Nothing has to be changed");
+        Assert.assertEquals(actualSelectedDate, expectedSelectedDate, "Nothing has to be changed");
+
+        writeStatus("Check 'scroll' mode");
+        selenium.select(boundaryDatesModeId, "scroll");
+        writeStatus("Click a day from next month, the month has to be scrolled to the next month, but selected date stays untouched");
+        clickById(firstMarCellId);
+        actualSelectedDate = selenium.getValue(inputDateId);
+        actualCurrentDate = selenium.getText(currentDateHeaderXpath);
+        Assert.assertEquals(actualCurrentDate, "March, 2007", "Month has to be switched to the next one");
+        Assert.assertEquals(actualSelectedDate, expectedSelectedDate, "Selected date has not to be changed");
+        writeStatus("Move back");
+        selenium.click("//td[@id='" + calendarHeaderId + "']/table/tbody/tr/td[@class='rich-calendar-tool'][2]/div");
+        writeStatus("Click a day from previous month, the month has to be scrolled to the previous month, selected date stays untouched as before");
+        clickById(thirtyFirstJanCellId);
+        actualSelectedDate = selenium.getValue(inputDateId);
+        actualCurrentDate = selenium.getText(currentDateHeaderXpath);
+        Assert.assertEquals(actualCurrentDate, "January, 2007", "Month has to be switched to the previous one");
+        Assert.assertEquals(actualSelectedDate, expectedSelectedDate, "Selected date has not to be changed");
+        writeStatus("Move back");
+        selenium.click("//td[@id='" + calendarHeaderId + "']/table/tbody/tr/td[@class='rich-calendar-tool'][3]/div");
+
+        writeStatus("Check 'select' mode");
+        selenium.select(boundaryDatesModeId, "select");
+        writeStatus("Click a day from next month: 1) the month has to be scrolled to the next month 2) date set to selected date (1st of March)");
+        clickById(firstMarCellId);
+        actualSelectedDate = selenium.getValue(inputDateId);
+        actualCurrentDate = selenium.getText(currentDateHeaderXpath);
+        Assert.assertEquals(actualCurrentDate, "March, 2007", "Month has to be switched to the next one");
+        Assert.assertEquals(actualSelectedDate, "03/01/2007 12:00", "Selected date has to be changed");
+        writeStatus("Move back");
+        selenium.click("//td[@id='" + calendarHeaderId + "']/table/tbody/tr/td[@class='rich-calendar-tool'][2]/div");
+        writeStatus("Click a day from previous month: 1) the month has to be scrolled to the previous month 2) date set to selected date (31st of January)");
+        clickById(thirtyFirstJanCellId);
+        actualSelectedDate = selenium.getValue(inputDateId);
+        actualCurrentDate = selenium.getText(currentDateHeaderXpath);
+        Assert.assertEquals(actualCurrentDate, "January, 2007", "Month has to be switched to the previous one");
+        Assert.assertEquals(actualSelectedDate, "01/31/2007 12:00", "Selected date has to be changed");
+        writeStatus("Move back");
+        selenium.click("//td[@id='" + calendarHeaderId + "']/table/tbody/tr/td[@class='rich-calendar-tool'][3]/div");
+    }
+
+    @Test
     public void testButtonRelatedAttributes(Template template) {
         renderPage(BUTTON_RELATED_TEST_URL, template, null);
         writeStatus("Check button-related attributes");




More information about the richfaces-svn-commits mailing list