You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2014/06/14 11:25:47 UTC
git commit: TAP5-2203: close the date picker pop-up when clicking
anywhere outside of it
Repository: tapestry-5
Updated Branches:
refs/heads/master 33eba2123 -> 9cd156f37
TAP5-2203: close the date picker pop-up when clicking anywhere outside of it
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9cd156f3
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9cd156f3
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9cd156f3
Branch: refs/heads/master
Commit: 9cd156f37f34cad965f2d366ba2c7869f6f345ca
Parents: 33eba21
Author: Jochen Kemnade <jk...@apache.org>
Authored: Sat Jun 14 11:23:32 2014 +0200
Committer: Jochen Kemnade <jk...@apache.org>
Committed: Sat Jun 14 11:23:32 2014 +0200
----------------------------------------------------------------------
.../META-INF/modules/t5/core/datefield.coffee | 11 +++++++++++
.../org/apache/tapestry5/integration/app1/FormTests.java | 10 +++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9cd156f3/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
index 530f6f6..9a9f63d 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
@@ -42,6 +42,17 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
# around the DOM.
activePopup = null
+
+ isPartOfPopup = (element) ->
+ element.findParent(".labelPopup")? or element.findParent(".datefield-popup")?
+
+ dom.body.on "click", ->
+ if activePopup and not isPartOfPopup @
+ activePopup.hide()
+ activePopup = null
+ return
+
+
class Controller
constructor: (@container) ->
@field = @container.findFirst "input"
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9cd156f3/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
index 5e997f3..cf85b7d 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
@@ -347,7 +347,7 @@ public class FormTests extends App1TestCase
waitForCondition("selenium.browserbot.getCurrentWindow().testSupport.findCSSMatchCount('td.selected') == 0", PAGE_LOAD_TIMEOUT);
}
- // TAP4-1408
+ // TAP5-1408, TAP5-2203
@Test
public void datefield_clickoutside_closes()
{
@@ -361,6 +361,14 @@ public class FormTests extends App1TestCase
click("css=.x-impact .btn");
waitForInvisible("css=div.datePicker");
+ //make sure that clicking somewhere outside the date picker
+ //closes it
+ click("css=.x-impact .btn");
+ waitForCSSSelectedElementToAppear("div.datePicker");
+
+ click("css=h1");
+ waitForInvisible("css=div.datePicker");
+
//also make sure that clicking the month label /doesn't/ close the picker
click("css=.x-impact .btn");
waitForCSSSelectedElementToAppear("div.datePicker");