You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/09/05 01:00:30 UTC

[4/6] git commit: Allow (for testing) to have the console active but completely invisible

Allow (for testing) to have the console active but completely invisible


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

Branch: refs/heads/master
Commit: 287e09678b56a281dabde6de53a175e1fb4d5e82
Parents: e745efe
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Wed Sep 4 15:14:05 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed Sep 4 15:14:05 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee           | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/287e0967/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 21b72fe..63d765c 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -37,7 +37,9 @@ define ["./dom", "underscore", "./bootstrap"],
 
       return
 
-    forceFloating = (dom.body.attribute "data-floating-console") == "true"
+    consoleAttribute = dom.body.attribute "data-floating-console"
+
+    forceFloating = consoleAttribute?
 
     button = (action, icon, label, disabled = false) -> """
         <button data-action="#{action}" class="btn btn-default btn-mini">
@@ -77,6 +79,13 @@ define ["./dom", "underscore", "./bootstrap"],
 
           dom.body.prepend floatingConsole
 
+          # Basically, any non-blank value will enable the floating console. In addition, the special
+          # value "invisible" will enable it but then hide it ... this is useful in tests, since
+          # the console output is captured in the markup, but the visible console can have unwanted interactions
+          # (such as obscuring elements that make them unclickable).
+          if consoleAttribute is "invisible"
+            floatingConsole.hide()
+
           messages = floatingConsole.findFirst ".message-container"
 
           floatingConsole.findFirst("[data-action=enable]").attribute "disabled", true
@@ -124,9 +133,6 @@ define ["./dom", "underscore", "./bootstrap"],
 
         messages.append div
 
-        # Make sure the console is visible, even if disabled (and even if the new content is hidden).
-        floatingConsole.show()
-
         # A slightly clumsy way to ensure that the container is scrolled to the bottom.
         _.delay -> messages.element.scrollTop = messages.element.scrollHeight