TAP5-2233: fix t:rowvalue XHR parameter if the RemoveRowLink contains 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/3e600c77 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3e600c77 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3e600c77 Branch: refs/heads/master Commit: 3e600c774baed0dabb7a19f93b9dba8946a9be45 Parents: 138414f Author: Jochen Kemnade <jochenkemn...@web.de> Authored: Sat Apr 26 17:40:06 2014 +0200 Committer: Jochen Kemnade <jochenkemn...@web.de> Committed: Sat Apr 26 17:41:20 2014 +0200 ---------------------------------------------------------------------- .../modules/t5/core/ajaxformloop.coffee | 2 +- .../src/test/app1/FormInjectorDemo.tml | 2 +- .../tapestry5/integration/app1/AjaxTests.java | 26 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3e600c77/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/ajaxformloop.coffee ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/ajaxformloop.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/ajaxformloop.coffee index 649dd6d..b60cf6c 100644 --- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/ajaxformloop.coffee +++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/ajaxformloop.coffee @@ -35,7 +35,7 @@ define ["./dom", "./events", "./console", "./ajax"], ajax url, data: - "t:rowvalue": @attr "data-afl-row-value" + "t:rowvalue": (@closest "[data-afl-row-value]").attr "data-afl-row-value" success: => # The server has removed the row from persistent storage, lets # do the same on the UI. http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3e600c77/tapestry-core/src/test/app1/FormInjectorDemo.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/app1/FormInjectorDemo.tml b/tapestry-core/src/test/app1/FormInjectorDemo.tml index 1a23729..68e2508 100644 --- a/tapestry-core/src/test/app1/FormInjectorDemo.tml +++ b/tapestry-core/src/test/app1/FormInjectorDemo.tml @@ -12,7 +12,7 @@ <div class="input-group"> <t:textfield t:id="value" value="item.value"/> <div class="input-group-addon"> - <t:removerowlink class="btn btn-warning btn-xs">remove</t:removerowlink> + <t:removerowlink class="btn btn-warning btn-xs"><t:glyphicon name="trash"/> remove</t:removerowlink> </div> </div> </div> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3e600c77/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java index 17cb399..528054f 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java @@ -201,6 +201,32 @@ public class AjaxTests extends App1TestCase assertText("sum", "0.0"); } + + @Test + public void remove_ajaxformloop_values_using_buttons_with_nested_elements() + { + openLinks("FormInjector Demo"); + + assertText("sum", "0.0"); + + click("link=Add another value"); + + sleep(AJAX_WAIT_TIME); + + type("//input[@type='text'][1]", "5.1"); + + clickAndWait(SUBMIT); + + assertText("sum", "5.1"); + + click("css=.glyphicon-trash"); + + sleep(AJAX_WAIT_TIME); + + clickAndWait(SUBMIT); + + assertText("sum", "0.0"); + } /** * TAP5-240