tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject git commit: TAP5-2028: Hide the alert container after transient alert auto-dismisses
Date Wed, 05 Jun 2013 15:49:03 GMT
Updated Branches:
  refs/heads/master 1bb0d1c23 -> b39079c84


TAP5-2028: Hide the alert container after transient alert auto-dismisses


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b39079c8
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b39079c8
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b39079c8

Branch: refs/heads/master
Commit: b39079c846152bdd47e1f529b81dd1f206522cc7
Parents: 1bb0d1c
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Wed Jun 5 08:48:49 2013 -0700
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Wed Jun 5 08:48:49 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/alert.coffee          |    3 +-
 .../tapestry5/integration/app1/AlertsTests.groovy  |   26 +++++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b39079c8/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
index e4aebe4..1e4711d 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
@@ -118,7 +118,8 @@ define ["./dom", "./console", "./messages", "./builder", "./ajax", "underscore"]
       container.append element
 
       if data['transient']
-        _.delay removeAlert, exports.TRANSIENT_DURATION, container, element
+        outerContainer = container.findParent '[data-container-type=alerts]'
+        _.delay removeAlert, exports.TRANSIENT_DURATION, outerContainer, element
 
     alert.TRANSIENT_DURATION = 5000
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b39079c8/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
index 7c898ad..87f4c3c 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
@@ -59,6 +59,32 @@ class AlertsTests extends TapestryCoreTestCase {
     }
 
     @Test
+    void remove_alert_container_with_last_transient_alert() {
+        openLinks "Alerts Demo", "Reset Alerts Storage"
+
+        select "id=severity", "Warn"
+        select "id=duration", "Transient"
+        type "id=message", "trad warn transient"
+
+        clickAndWait "//input[@value='Traditional Update']"
+
+        waitForCSSSelectedElementToAppear "$CONTAINER .alert"
+
+        assertTextPresent "trad warn transient"
+
+        // dismiss the first alert that indicates the submission type
+
+        click "css=$CONTAINER :contains('Traditional form submission') button.close"
+
+        // wait for the transient alert to be automatically removed
+        sleep 5000
+
+        // Check that the alert container is now empty
+
+        assertText "css=$CONTAINER", ""
+    }
+
+    @Test
     void ajax_update_and_remove() {
         openLinks "Alerts Demo", "Reset Alerts Storage"
 


Mime
View raw message