Repository: tapestry-5 Updated Branches: refs/heads/master 36375f07c -> 1a37c6abd
TAP5-2183: correctly set the submitting element for LinkSumbit component with nested elements Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/f65adf64 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/f65adf64 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/f65adf64 Branch: refs/heads/master Commit: f65adf64c9311c8246a36fdd1a4ccbc692f7765c Parents: 36375f0 Author: Jochen Kemnade <jochenkemn...@web.de> Authored: Sun Apr 27 12:48:01 2014 +0200 Committer: Jochen Kemnade <jochenkemn...@web.de> Committed: Sun Apr 27 12:48:01 2014 +0200 ---------------------------------------------------------------------- .../META-INF/modules/t5/core/forms.coffee | 2 +- tapestry-core/src/test/app1/LinkSubmitDemo.tml | 1 + .../tapestry5/integration/app1/FormTests.java | 16 ++++++++++++++++ .../integration/app1/pages/LinkSubmitDemo.java | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f65adf64/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee index e148189..c20714a 100644 --- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee +++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee @@ -180,7 +180,7 @@ define ["./events", "./dom", "underscore"], console.error "Submitting link element not contained inside a form element." return false - setSubmittingHidden form, this + setSubmittingHidden form, @closest "a[data-submit-mode]" # Now the ugly part; if we just invoke submit() on the form, it does not trigger # the form's "submit" event, which we need. http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f65adf64/tapestry-core/src/test/app1/LinkSubmitDemo.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/app1/LinkSubmitDemo.tml b/tapestry-core/src/test/app1/LinkSubmitDemo.tml index 6c5a196..7764e30 100644 --- a/tapestry-core/src/test/app1/LinkSubmitDemo.tml +++ b/tapestry-core/src/test/app1/LinkSubmitDemo.tml @@ -10,6 +10,7 @@ <t:linksubmit class="btn btn-default" t:id="fred" context="formContext" alt="f">Fred</t:linksubmit> <t:linksubmit class="btn btn-default" t:id="barney" defer="true" event="neighbor" alt="b">Barney</t:linksubmit> + <t:linksubmit class="btn btn-default" t:id="pebbles" defer="true" event="daughter" alt="p"><t:glyphicon name="star"/> Pebbles</t:linksubmit> </t:form> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f65adf64/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 946a0bb..b0bf953 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 @@ -857,6 +857,22 @@ public class FormTests extends App1TestCase assertText("name-value", "Betty"); assertText("last-clicked", "Barney"); } + + /** + * TAP5-2183 + */ + @Test + public void link_submit_component_with_nested_element() + { + openLinks("LinkSubmit Demo"); + + type("name", "Wilma"); + + clickAndWait("css=.glyphicon-star"); + + assertText("name-value", "Wilma"); + assertText("last-clicked", "Pebbles"); + } @Test public void calendar_field_inside_bean_editor() http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f65adf64/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java index 9299619..4832f63 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java @@ -46,4 +46,6 @@ public class LinkSubmitDemo } void onNeighbor() { lastClicked = "Barney"; } + + void onDaughter() { lastClicked = "Pebbles"; } }