Author: hlship Date: Wed Mar 4 20:22:44 2009 New Revision: 750139 URL: http://svn.apache.org/viewvc?rev=750139&view=rev Log: TAP5-389: Linksubmit doesn't work inside a form with Zone parameter set
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml?rev=750139&view=auto ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml (added) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml Wed Mar 4 20:22:44 2009 @@ -0,0 +1,27 @@ +<t:border xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" + xmlns:p="tapestry:parameter"> + + <h1>LinkSubmit inside Zone</h1> + + <p>Current time: + <span id="now">${now}</span> + </p> + + + <t:zone t:id="output"> + <t:if test="value"> + <p>You entered + <span id="outputvalue">${value}</span> + </p> + </t:if> + </t:zone> + + + <t:form zone="output"> + <t:errors/> + <t:textfield t:id="value"/> + <br/> + <t:linksubmit>submit</t:linksubmit> + </t:form> + +</t:border> \ No newline at end of file Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=750139&r1=750138&r2=750139&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java Wed Mar 4 20:22:44 2009 @@ -2762,4 +2762,29 @@ assertText("zoneOutput", "Updated via form submission."); } + + /** + * TAP5-389 + */ + public void link_submit_inside_form_that_updates_a_zone() + { + start("LinkSubmit inside Zone"); + + String now = getText("now"); + + click("link=submit"); + + waitForElementToAppear("value:errorpopup"); + + type("value", "robot chicken"); + + click("link=submit"); + + waitForElementToAppear("outputvalue"); + + assertText("outputvalue", "robot chicken"); + + // Make sure it was a partial update + assertText("now", now); + } } \ No newline at end of file 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=750139&r1=750138&r2=750139&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 Wed Mar 4 20:22:44 2009 @@ -65,6 +65,9 @@ private static final List<Item> ITEMS = CollectionFactory.newList( + new Item("LinkSubmitInZoneDemo", "LinkSubmit inside Zone", + "Ensure that a LinkSubmit works correctly when its containing Form updates a Zone"), + new Item("SlowAjaxDemo", "Slow Ajax Demo", "Handling of client-side Ajax before the page is fully loaded"), new Item("ProgressiveDemo", "ProgressiveDisplay Demo", "Progressive Enhancement via a component"), Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java?rev=750139&view=auto ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java (added) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java Wed Mar 4 20:22:44 2009 @@ -0,0 +1,42 @@ +// Copyright 2009 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.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.beaneditor.Validate; +import org.apache.tapestry5.corelib.components.Zone; + +import java.util.Date; + +public class LinkSubmitInZoneDemo +{ + @Property + @Validate("required") + private String value; + + @InjectComponent + private Zone output; + + Object onSuccess() + { + return output.getBody(); + } + + public Date getNow() + { + return new Date(); + } +}