tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertdzeig...@apache.org
Subject svn commit: r1159019 - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ tapestry-core/src/main/java/org/apache/tapestry5/services/ tap...
Date Thu, 18 Aug 2011 04:02:07 GMT
Author: robertdzeigler
Date: Thu Aug 18 04:02:07 2011
New Revision: 1159019

URL: http://svn.apache.org/viewvc?rev=1159019&view=rev
Log:
TAP5-1558: FormFragment should allow more fine grained control over when to be considered
"invisible"

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentExplicitVisibleBoundsDemo.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientBehaviorSupport.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-formfragment.js
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/FormFragmentExplicitVisibleBoundsDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
    tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
Thu Aug 18 04:02:07 2011
@@ -108,6 +108,17 @@ public class FormFragment implements Cli
     @Parameter(name = "id", defaultPrefix = BindingConstants.LITERAL)
     private String idParameter;
 
+    /**
+     * A javascript function that overrides the default visibility search bound.
+     * Tapestry normally ensures that not only the form fragment but all parent elements
up to the containing form
+     * are visible when determining whether to submit the contents of a form fragment.  This
behavior can be modified by
+     * supplying a javascript function that receives the "current" element in the chain.
 Returning true will stop the
+     * search (and report "isDeepVisible" as true).  Returning false will continue the search
up the chain.
+     * @since 5.3
+     */
+    @Parameter(defaultPrefix = BindingConstants.LITERAL, allowNull = false)
+    private String visibleBound;
+
     @Inject
     private Environment environment;
 
@@ -159,7 +170,7 @@ public class FormFragment implements Cli
         if (!visible)
             element.addClassName(CSSClassConstants.INVISIBLE);
 
-        clientBehaviorSupport.addFormFragment(clientId, alwaysSubmit, show, hide);
+        clientBehaviorSupport.addFormFragment(clientId, alwaysSubmit, show, hide, visibleBound);
 
         componentActions = new ComponentActionSink(logger, clientDataEncoder);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java
Thu Aug 18 04:02:07 2011
@@ -18,6 +18,7 @@ import org.apache.tapestry5.Field;
 import org.apache.tapestry5.Link;
 import org.apache.tapestry5.corelib.data.InsertPosition;
 import org.apache.tapestry5.json.JSONArray;
+import org.apache.tapestry5.json.JSONLiteral;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.ClientBehaviorSupport;
 import org.apache.tapestry5.services.Environment;
@@ -57,10 +58,10 @@ public class ClientBehaviorSupportImpl i
         javascriptSupport.addInitializerCall("zone", spec);
     }
 
-    private void addFunction(JSONObject spec, String key, String showFunctionName)
+    private void addFunction(JSONObject spec, String key, String functionName)
     {
-        if (showFunctionName != null)
-            spec.put(key, showFunctionName.toLowerCase());
+        if (functionName != null)
+            spec.put(key, functionName.toLowerCase());
     }
 
     public void linkZone(String linkId, String elementId, Link eventLink)
@@ -75,16 +76,27 @@ public class ClientBehaviorSupportImpl i
      */
     public void addFormFragment(String clientId, String showFunctionName, String hideFunctionName)
     {
-        addFormFragment(clientId, false, showFunctionName, hideFunctionName);
+        addFormFragment(clientId, false, showFunctionName, hideFunctionName, null);
     }
 
+    /**
+     * @deprecated Use {@link #addFormFragment(String, boolean, String, String, String)}
instead
+     */
     public void addFormFragment(String clientId, boolean alwaysSubmit, String showFunctionName,
String hideFunctionName)
     {
+        addFormFragment(clientId, false, showFunctionName, hideFunctionName, null);
+    }
+
+    public void addFormFragment(String clientId, boolean alwaysSubmit, String showFunctionName,
String hideFunctionName, String visibilityBoundFunctionName)
+    {
         JSONObject spec = new JSONObject("element", clientId);
 
         addFunction(spec, "show", showFunctionName);
         addFunction(spec, "hide", hideFunctionName);
 
+        if (visibilityBoundFunctionName != null)
+            spec.put("bound", new JSONLiteral(visibilityBoundFunctionName));
+
         if (alwaysSubmit)
             spec.put("alwaysSubmit", true);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientBehaviorSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientBehaviorSupport.java?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientBehaviorSupport.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientBehaviorSupport.java
Thu Aug 18 04:02:07 2011
@@ -63,7 +63,7 @@ public interface ClientBehaviorSupport
      *            or null for the default
      * @param hideFunctionName
      *            name of the function used to make the SubForm invisible, or null for the
default
-     * @deprecated Use {@link #addFormFragment(String,boolean,String,String)} instead
+     * @deprecated Use {@link #addFormFragment(String,boolean,String,String,String)} instead
      */
     void addFormFragment(String clientId, String showFunctionName, String hideFunctionName);
 
@@ -80,10 +80,30 @@ public interface ClientBehaviorSupport
      *            or null for the default
      * @param hideFunctionName
      *            name of the function used to make the SubForm invisible, or null for the
default
+     * @deprecated Use {@link #addFormFragment(String,boolean,String,String,String)} instead
      */
     void addFormFragment(String clientId, boolean alwaysSubmit, String showFunctionName,
String hideFunctionName);
 
     /**
+     * Adds a new client-side Tapestry.FormFragment object. FormFragment's are used to make
parts of a client-side form
+     * visible or invisible, which involves interactions with both the server-side and client-side
validation.
+     *
+     * @param clientId
+     *            client-side id of the element that will be made visible or invisible
+     * @param alwaysSubmit
+     *            if true, the fragment ignores client-side visiblility and always submits
its values
+     * @param showFunctionName
+     *            name of function (of the Tapestry.ElementEffect object) used to make the
SubForm visible,
+     *            or null for the default
+     * @param hideFunctionName
+     *            name of the function used to make the SubForm invisible, or null for the
default
+     * @param visibilityBoundFunctionName
+     *            name of the function used to bound the isDeepVisible search, or null for
the default
+     * @since 5.3
+     */
+    void addFormFragment(String clientId, boolean alwaysSubmit, String showFunctionName,
String hideFunctionName, String visibilityBoundFunctionName);
+
+    /**
      * Adds a new client-side Tapestry.FormInjector object. FormInjectors are used to extend
an existing Form with new
      * content.
      * 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-formfragment.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-formfragment.js?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-formfragment.js
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-formfragment.js
Thu Aug 18 04:02:07 2011
@@ -7,14 +7,15 @@ T5.extendInitializers(function() {
         var hidden = $(spec.element + "-hidden");
         var form = $(hidden.form);
 
+        var opts = (spec.bound && { bound: spec.bound }) || {};
         if (! spec.alwaysSubmit) {
-            hidden.disabled = !  element.isDeepVisible();
+            hidden.disabled = !  element.isDeepVisible(opts);
         }
 
         function updateUI(makeVisible) {
 
             if (! spec.alwaysSubmit) {
-                hidden.disabled = ! (makeVisible && element.parentNode.isDeepVisible());
+                hidden.disabled = ! (makeVisible && element.parentNode.isDeepVisible(opts));
             }
 
             var effect = makeVisible ? Tapestry.ElementEffect[spec.show]

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
Thu Aug 18 04:02:07 2011
@@ -654,17 +654,22 @@ Element.addMethods({
      *
      * @param element
      *            to search up from
+     * @param options
+     *            Optional map of options. Only used key currently is "bound" which should
be a javascript function name
+     *            that determines whether the current element bounds the search. The default
is to stop the search when
+     *            the
      * @return true if visible (and containers visible), false if it or
      *         container are not visible
      */
-    isDeepVisible : function(element) {
+    isDeepVisible : function(element, options) {
         var current = $(element);
+        var boundFunc = (options && options.bound) || function(el) { return el.tagName
== "FORM"};
 
         while (true) {
             if (!current.visible())
                 return false;
 
-            if (current.tagName == "FORM")
+            if (boundFunc(current))
                 break;
 
             current = $(current.parentNode);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/FormFragmentExplicitVisibleBoundsDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/FormFragmentExplicitVisibleBoundsDemo.tml?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/FormFragmentExplicitVisibleBoundsDemo.tml
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/FormFragmentExplicitVisibleBoundsDemo.tml
Thu Aug 18 04:02:07 2011
@@ -1,12 +1,34 @@
 <html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+<script type="text/javascript">
+    function visibleSearchDone(el)
+    {
+        return el.id == "container1" || el.id == "container2";
+    }
+</script>
     <t:form>
-        <div id="tab1">
-            <t:formfragment>
+        <t:errors/>
+        <div id="tab1" style="${tab1style}">
+            <h1>Tab 1</h1>
+            <div id="container1">
+                <t:checkbox t:id="frag1check" value="frag1visible" t:mixins="triggerfragment"
fragment="fragment1"/>
 
-            </t:formfragment>
+                <t:formfragment t:id="fragment1" t:visible="frag1visible" visibleBound="visibleSearchDone">
+                    <t:textfield t:id="value1" validate="required"/>
+                </t:formfragment>
+            </div>
         </div>
-        <div id="tab2">
-
+        <div id="tab2" style="${tab2style}">
+            <h1>Tab 2</h1>
+            <div id="container2">
+                <t:checkbox t:id="frag2check" value="frag2visible" t:mixins="triggerfragment"
fragment="fragment2"/>
+                <t:formfragment t:id="fragment2" t:visible="frag2visible" visibleBound="visibleSearchDone">
+                    <t:textfield t:id="value2"/>
+                </t:formfragment>
+            </div>
         </div>
+        <a id="tab1display" href="#" onclick="Tapestry.ajaxRequest('${tab1Link}', {onSuccess:
function() { $('tab2').hide();$('tab1').show();}}); return false;">Show Tab 1</a>
+        <a id="tab2display" href="#" onclick="Tapestry.ajaxRequest('${tab2Link}', {onSuccess:
function() { $('tab1').hide();$('tab2').show();}}); return false;">Show Tab 2</a>
+        <a t:id="clearState" t:type="actionlink">Clear Saved State</a>
+        <t:submit t:id="saveform"/>
     </t:form>
 </html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
Thu Aug 18 04:02:07 2011
@@ -104,6 +104,83 @@ public class AjaxTests extends TapestryC
     }
 
     @Test
+    public void form_fragment_explicit_visible_bounds()
+    {
+        openLinks("Form Fragment Explicit Visible Bounds Demo");
+
+        //make sure we're on tab 1...
+        switchTabs(1);
+        type("value1", "Some text to check");
+        switchTabs(2);
+
+        type("value2", "Some other text to check");
+
+        clickAndWait("saveform");
+
+        assertTrue(isVisible("tab2"));
+
+        assertFieldValue("value2", "Some other text to check");
+
+        switchTabs(1);
+
+        assertFieldValue("value1", "Some text to check");
+
+        //make sure they don't save if not revealed...
+        type("value1", "new text that shouldn't save");
+        click("frag1check");
+        waitForInvisible("value1");
+
+        clickAndWait("saveform");
+        assertTrue(isVisible("tab1"));
+        assertFalse(isVisible("value1"));
+        click("frag1check");
+        waitForVisible("value1");
+        assertFieldValue("value1", "Some text to check");
+
+        switchTabs(2);
+        assertFieldValue("value2", "Some other text to check");
+        clickAndWait("link=Clear Saved State");
+    }
+
+    @Test
+    public void form_fragment_visible_bound_validation()
+    {
+        openLinks("Form Fragment Explicit Visible Bounds Demo");
+        //make sure we're on the correct tab...
+        switchTabs(1);
+        //and that value1 is blank...
+        type("value1", "");
+        assertFieldValue("value1", "");
+        //submitting should result in error in value1...
+        click("saveform");
+        assertBubbleMessage("value1", "You must provide a value for Value1.");
+
+        //still wind up being able to submit here b/c there's no (good) way to highlight
the error in the invisible tab.
+        //but the form should return with errors.
+        switchTabs(2);
+        clickAndWait("saveform");
+        assertTextPresent("You must provide a value for Value1.");
+
+        switchTabs(1);
+        click("frag1check");
+        waitForInvisible("value1");
+
+        clickAndWait("saveform");
+        assertFalse(isTextPresent("You must provide a value for Value1."));
+
+        switchTabs(1);
+        clickAndWait("saveform");
+        assertFalse(isTextPresent("You must provide a value for Value1."));
+        clickAndWait("link=Clear Saved State");
+    }
+
+    private void switchTabs(int tab)
+    {
+        click("link=Show Tab " + tab);
+        waitForVisible("tab" + tab);
+    }
+
+    @Test
     public void form_injector()
     {
         openLinks("FormInjector Demo");

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=1159019&r1=1159018&r2=1159019&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
Thu Aug 18 04:02:07 2011
@@ -293,7 +293,7 @@ public class FormTests extends TapestryC
         waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
 
         String value = getValue("asteroidImpact");
-        assertEquals(value, new SimpleDateFormat("M/d/yyyy").format(new Date()));
+        assertFieldValue("asteroidImpact", new SimpleDateFormat("M/d/yyyy").format(new Date()));
 
         //#2...
         click("id=asteroidImpact-trigger");
@@ -307,21 +307,21 @@ public class FormTests extends TapestryC
         //#1
         click("css=button.todayButton");
         waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
-        assertEquals(getValue("asteroidImpact"), value);
+        assertFieldValue("asteroidImpact", value);
 
         //#4...
         click("id=asteroidImpact-trigger");
         waitForCSSSelectedElementToAppear("div.datePicker");
         click("css=button.noneButton");
         waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
-        assertEquals(getValue("asteroidImpact"), "");
+        assertFieldValue("asteroidImpact", "");
 
         click("id=asteroidImpact-trigger");
         waitForCSSSelectedElementToAppear("div.datePicker");
         assertFalse(isElementPresent("css=td.selected"));
         click("css=button.noneButton");
         waitForCondition(pickerGoneCondition, PAGE_LOAD_TIMEOUT);
-        assertEquals(getValue("asteroidImpact"), "");
+        assertFieldValue("asteroidImpact", "");
     }
 
     // TAP4-1408

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentExplicitVisibleBoundsDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentExplicitVisibleBoundsDemo.java?rev=1159019&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentExplicitVisibleBoundsDemo.java
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentExplicitVisibleBoundsDemo.java
Thu Aug 18 04:02:07 2011
@@ -0,0 +1,102 @@
+// Copyright 2011 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+
+import javax.inject.Inject;
+import javax.persistence.PersistenceProperty;
+
+/**
+ * Demos the use of explicit bounds for checking visibility of a form fragment for form submission
processing.
+ * By default, a FormFragment searches to make sure the containing form is visible via "isDeepVisible".
 If
+ * no intermediate parent elements are invisible, the fragment is considered visible.  However,
there are times when
+ * that behavior is not desired; some element other than form should be used as the stopping
point for determining
+ * visibility.  This page demonstrates that use case.
+ */
+public class FormFragmentExplicitVisibleBoundsDemo {
+
+    @Property
+    @Persist
+    private String value1;
+
+    @Property
+    @Persist
+    private String value2;
+
+    @Property
+    @Persist
+    private boolean frag1visible;
+
+    @Property
+    @Persist
+    private boolean frag2visible;
+
+    @Property
+    @Persist
+    private String activeTab;
+
+    void setupRender()
+    {
+        if (activeTab == null) {
+            activeTab = "tab1";
+            frag1visible = true;
+            frag2visible = true;
+        }
+    }
+
+    @Inject
+    private ComponentResources resources;
+
+    public String getTab1Link()
+    {
+        return tabLink("tab1");
+    }
+
+    public String getTab2Link()
+    {
+        return tabLink("tab2");
+    }
+
+    private String tabLink(String tab) {
+        return resources.createEventLink("showTab", tab).toAbsoluteURI();
+    }
+
+    void onShowTab(String tabName)
+    {
+        activeTab = tabName;
+    }
+
+    public String getTab1style()
+    {
+        return tabStyle("tab1");
+    }
+
+    public String getTab2style()
+    {
+        return tabStyle("tab2");
+    }
+
+    private String tabStyle(String tab)
+    {
+        return tab.equals(activeTab)?"":"display: none";
+    }
+
+    void onActionFromClearState()
+    {
+        resources.discardPersistentFieldChanges();
+    }
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
Thu Aug 18 04:02:07 2011
@@ -493,7 +493,9 @@ public class Index
 
                     new Item("MapExpressionInExpansions", "Map Expressions in Expansions
Demo", "Maps can be used in expansions"),
 
-                    new Item("FormFieldFocusDemo", "FormFieldFocus Demo", "Setting the Form
focus on a specific field")
+                    new Item("FormFieldFocusDemo", "FormFieldFocus Demo", "Setting the Form
focus on a specific field"),
+
+                    new Item("FormFragmentExplicitVisibleBoundsDemo", "Form Fragment Explicit
Visible Bounds Demo", "Check for form fragment parent visibility can be bounded to")
 
             );
 

Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java?rev=1159019&r1=1159018&r2=1159019&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
Thu Aug 18 04:02:07 2011
@@ -1366,6 +1366,35 @@ public abstract class SeleniumTestCase e
     }
 
     /**
+     * Waits for the element specified by the selector to become visible
+     * Note that waitForElementToAppear waits for the element to be present in the dom, visible
or not. waitForVisible
+     * waits for an element that already exists in the dom to become visible.
+     * @param selector
+     *              element selector
+     * @since 5.3
+     */
+    protected final void waitForVisible(String selector)
+    {
+        String condition = String.format("selenium.isVisible(\"%s\")", selector);
+
+        waitForCondition(condition, PAGE_LOAD_TIMEOUT);
+    }
+
+    /**
+     * Waits for the element specified by the selector to become invisible
+     * Note that waitForElementToDisappear waits for the element to be absent from the dom,
visible or not. waitForInvisible
+     * waits for an existing element to become invisible.
+     * @param selector
+     *              element selector
+     * @since 5.3
+     */
+    protected final void waitForInvisible(String selector)
+    {
+        String condition = String.format("!selenium.isVisible(\"%s\")", selector);
+
+        waitForCondition(condition, PAGE_LOAD_TIMEOUT);
+    }
+    /**
      * Asserts that the current page's title matches the expected value.
      * 
      * @since 5.3



Mime
View raw message