Repository: wicket Updated Branches: refs/heads/master de4e8a412 -> 433190904
Added WicketTester support for IAjaxLink WicketTester didn't click direct IAjaxLink implementations using an Ajax request but a normal request. Some components implement IAjaxLink directly instead of subclassing AjaxLink or other components. Fixes WICKET-5900 Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/43319090 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/43319090 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/43319090 Branch: refs/heads/master Commit: 433190904eb3fd48f974852d71f42e84b4c49d04 Parents: de4e8a4 Author: Martijn Dashorst <[email protected]> Authored: Wed May 6 11:22:55 2015 +0200 Committer: Martijn Dashorst <[email protected]> Committed: Wed May 6 11:23:21 2015 +0200 ---------------------------------------------------------------------- .../org/apache/wicket/util/tester/BaseWicketTester.java | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/43319090/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java index 40210d6..f94305c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java +++ b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java @@ -60,6 +60,7 @@ import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior; import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.ajax.markup.html.IAjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; import org.apache.wicket.behavior.AbstractAjaxBehavior; import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler; @@ -1855,6 +1856,16 @@ public class BaseWicketTester submitAjaxFormSubmitBehavior(link, (AjaxFormSubmitBehavior)WicketTesterHelper.findAjaxEventBehavior(link, "click")); } + // if the link is an IAjaxLink, use it (do check if AJAX is expected) + else if (linkComponent instanceof IAjaxLink && isAjax) + { + List<AjaxEventBehavior> behaviors = WicketTesterHelper.findAjaxEventBehaviors( + linkComponent, "click"); + for (AjaxEventBehavior behavior : behaviors) + { + executeBehavior(behavior); + } + } /* * If the link is a submitlink then we pretend to have clicked it */
