You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by ro...@apache.org on 2011/09/02 17:56:07 UTC

svn commit: r1164595 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js test/java/org/apache/tapestry5/integration/app1/FormTests.java

Author: robertdzeigler
Date: Fri Sep  2 15:56:07 2011
New Revision: 1164595

URL: http://svn.apache.org/viewvc?rev=1164595&view=rev
Log:
TAP5-1408: datefield popup does not have option to cancel
Resolve issue with original fix where selecting a month from the month dropdown would close the datepicker. Thanks to bkopelove for tracking down the issue and providing a fix.

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js?rev=1164595&r1=1164594&r2=1164595&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js Fri Sep  2 15:56:07 2011
@@ -328,7 +328,7 @@ DatePicker.prototype.create = function (
         var insideDatePicker = null;
         var parent = targ.parentNode;
         while (parent != null) {
-            if (parent.className == 'datePicker') {
+            if (parent.className == 'datePicker'/* || parent.className == 'labelPopup'*/) {
                 insideDatePicker = parent;
                 break;
             }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java?rev=1164595&r1=1164594&r2=1164595&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java Fri Sep  2 15:56:07 2011
@@ -274,8 +274,8 @@ public class FormTests extends TapestryC
         waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
 
         click("xpath=//td[text()='28']");
-        String pickerGoneCondition = "!selenium.isVisible('css=div.datePicker')";
-        waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
+        String pickerGoneSelector="css=div.datePicker";
+        waitForInvisible(pickerGoneSelector);
 
         assertFieldValue("asteroidImpact", "6/28/2035");
 
@@ -290,7 +290,7 @@ public class FormTests extends TapestryC
         click("id=asteroidImpact-trigger");
         waitForCSSSelectedElementToAppear("div.datePicker");
         click("css=button.todayButton");
-        waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
+        waitForInvisible(pickerGoneSelector);
 
         String value = getValue("asteroidImpact");
         assertFieldValue("asteroidImpact", new SimpleDateFormat("M/d/yyyy").format(new Date()));
@@ -306,21 +306,21 @@ public class FormTests extends TapestryC
 
         //#1
         click("css=button.todayButton");
-        waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
+        waitForInvisible(pickerGoneSelector);
         assertFieldValue("asteroidImpact", value);
 
         //#4...
         click("id=asteroidImpact-trigger");
         waitForCSSSelectedElementToAppear("div.datePicker");
         click("css=button.noneButton");
-        waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
+        waitForInvisible(pickerGoneSelector);
         assertFieldValue("asteroidImpact", "");
 
         click("id=asteroidImpact-trigger");
         waitForCSSSelectedElementToAppear("div.datePicker");
         assertFalse(isElementPresent("css=td.selected"));
         click("css=button.noneButton");
-        waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
+        waitForInvisible(pickerGoneSelector);
         assertFieldValue("asteroidImpact", "");
     }
 
@@ -335,7 +335,17 @@ public class FormTests extends TapestryC
         waitForCSSSelectedElementToAppear("div.datePicker");
 
         click("id=asteroidImpact");
-        waitForCondition("!selenium.isVisible('css=div.datePicker')", PAGE_LOAD_TIMEOUT);
+        waitForInvisible("css=div.datePicker");
+
+        //also make sure that clicking the month label /doesn't/ close the picker
+        click("id=asteroidImpact-trigger");
+        waitForCSSSelectedElementToAppear("div.datePicker");
+        click("css=a.topLabel");
+        waitForCSSSelectedElementToAppear("div.labelPopup");
+        click("css=div.labelPopup a");
+
+        waitForCondition("!selenium.isElementPresent('css=div.labelPopup')", PAGE_LOAD_TIMEOUT);
+        assertTrue(isVisible("css=div.datePicker"));
     }
 
     @Test