You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by da...@apache.org on 2015/07/08 13:03:55 UTC

wicket git commit: Fixed IAjaxLink clicks in WicketTester

Repository: wicket
Updated Branches:
  refs/heads/master bae94e2d3 -> 354293e73


Fixed IAjaxLink clicks in WicketTester

Not all links are `AjaxLink`s or `AjaxFallbackLink`s, but rather direct
implementations of `IAjaxLink`. WicketTester didn't account for this
scenario, and this fixes that.


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/354293e7
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/354293e7
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/354293e7

Branch: refs/heads/master
Commit: 354293e7390453d63ef1dac18e72b269b69e7d9b
Parents: bae94e2
Author: Martijn Dashorst <ma...@gmail.com>
Authored: Wed Apr 29 16:15:02 2015 +0200
Committer: Martijn Dashorst <ma...@gmail.com>
Committed: Wed Jul 8 13:03:23 2015 +0200

----------------------------------------------------------------------
 .../wicket/util/tester/BaseWicketTester.java    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/354293e7/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 71d1943..8947ea2 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
@@ -1913,6 +1913,26 @@ public class BaseWicketTester
 			}
 		}
 		/*
+		 * If the link is an instanceof IAjaxLink, it is not one of the
+		 * special cases marked above, so we treat it as an AjaxLink.
+		 */
+		else if (linkComponent instanceof IAjaxLink) 
+		{
+			// If it's not ajax we fail
+			if (isAjax == false)
+			{
+				fail("Link " + path + "is an AjaxLink and will " +
+					"not be invoked when AJAX (javascript) is disabled.");
+			}
+
+			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
 		 */
 		else if (linkComponent instanceof SubmitLink)


Re: wicket git commit: Fixed IAjaxLink clicks in WicketTester

Posted by Martijn Dashorst <ma...@gmail.com>.
I was working in an older workspace and this commit was still not
pushed. I didn't remember closing the issue, so I rebased master and
didn't see any conflicts, so pushing was the next thing on the list.

It was an oversight. Good catch.

Martijn


On Wed, Jul 8, 2015 at 4:30 PM, Martin Grigorov <mg...@apache.org> wrote:
> I've asked because I didn't want to revert/change someone else's commit
> before asking him what was the intention.
>
> Martin Grigorov
> Freelancer. Available for hire!
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Jul 8, 2015 at 5:18 PM, Andrea Del Bene <an...@gmail.com>
> wrote:
>
>> I've noted the same problem. I did some cleaning inside
>> BaseWicketTester.clickLink(String, boolean), some if blocks were not
>> required:
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/diff/a241db57
>>
>>  Hi Martijn,
>>>
>>> Why did you make this change ?
>>> There is already "else if (linkComponent instanceof IAjaxLink && isAjax)"
>>> few lines above [1] that you added few weeks ago with WICKET-5900.
>>>
>>> The problem is that there is a broken test now:
>>>
>>> http://ci.apache.org/builders/wicket-master/builds/23/steps/compile/logs/stdio
>>>
>>> 1.
>>>
>>> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java#L1906
>>>
>>>
>>> Martin Grigorov
>>> Freelancer. Available for hire!
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Wed, Jul 8, 2015 at 2:03 PM, <da...@apache.org> wrote:
>>>
>>>
>>>
>>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Re: wicket git commit: Fixed IAjaxLink clicks in WicketTester

Posted by Martin Grigorov <mg...@apache.org>.
I've asked because I didn't want to revert/change someone else's commit
before asking him what was the intention.

Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jul 8, 2015 at 5:18 PM, Andrea Del Bene <an...@gmail.com>
wrote:

> I've noted the same problem. I did some cleaning inside
> BaseWicketTester.clickLink(String, boolean), some if blocks were not
> required:
>
> http://git-wip-us.apache.org/repos/asf/wicket/diff/a241db57
>
>  Hi Martijn,
>>
>> Why did you make this change ?
>> There is already "else if (linkComponent instanceof IAjaxLink && isAjax)"
>> few lines above [1] that you added few weeks ago with WICKET-5900.
>>
>> The problem is that there is a broken test now:
>>
>> http://ci.apache.org/builders/wicket-master/builds/23/steps/compile/logs/stdio
>>
>> 1.
>>
>> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java#L1906
>>
>>
>> Martin Grigorov
>> Freelancer. Available for hire!
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Wed, Jul 8, 2015 at 2:03 PM, <da...@apache.org> wrote:
>>
>>
>>
>

Re: wicket git commit: Fixed IAjaxLink clicks in WicketTester

Posted by Andrea Del Bene <an...@gmail.com>.
I've noted the same problem. I did some cleaning inside 
BaseWicketTester.clickLink(String, boolean), some if blocks were not 
required:

http://git-wip-us.apache.org/repos/asf/wicket/diff/a241db57
> Hi Martijn,
>
> Why did you make this change ?
> There is already "else if (linkComponent instanceof IAjaxLink && isAjax)"
> few lines above [1] that you added few weeks ago with WICKET-5900.
>
> The problem is that there is a broken test now:
> http://ci.apache.org/builders/wicket-master/builds/23/steps/compile/logs/stdio
>
> 1.
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java#L1906
>
>
> Martin Grigorov
> Freelancer. Available for hire!
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Jul 8, 2015 at 2:03 PM, <da...@apache.org> wrote:
>
>


Re: wicket git commit: Fixed IAjaxLink clicks in WicketTester

Posted by Martin Grigorov <mg...@apache.org>.
Hi Martijn,

Why did you make this change ?
There is already "else if (linkComponent instanceof IAjaxLink && isAjax)"
few lines above [1] that you added few weeks ago with WICKET-5900.

The problem is that there is a broken test now:
http://ci.apache.org/builders/wicket-master/builds/23/steps/compile/logs/stdio

1.
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java#L1906


Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jul 8, 2015 at 2:03 PM, <da...@apache.org> wrote:

> Repository: wicket
> Updated Branches:
>   refs/heads/master bae94e2d3 -> 354293e73
>
>
> Fixed IAjaxLink clicks in WicketTester
>
> Not all links are `AjaxLink`s or `AjaxFallbackLink`s, but rather direct
> implementations of `IAjaxLink`. WicketTester didn't account for this
> scenario, and this fixes that.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/354293e7
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/354293e7
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/354293e7
>
> Branch: refs/heads/master
> Commit: 354293e7390453d63ef1dac18e72b269b69e7d9b
> Parents: bae94e2
> Author: Martijn Dashorst <ma...@gmail.com>
> Authored: Wed Apr 29 16:15:02 2015 +0200
> Committer: Martijn Dashorst <ma...@gmail.com>
> Committed: Wed Jul 8 13:03:23 2015 +0200
>
> ----------------------------------------------------------------------
>  .../wicket/util/tester/BaseWicketTester.java    | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/354293e7/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 71d1943..8947ea2 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
> @@ -1913,6 +1913,26 @@ public class BaseWicketTester
>                         }
>                 }
>                 /*
> +                * If the link is an instanceof IAjaxLink, it is not one
> of the
> +                * special cases marked above, so we treat it as an
> AjaxLink.
> +                */
> +               else if (linkComponent instanceof IAjaxLink)
> +               {
> +                       // If it's not ajax we fail
> +                       if (isAjax == false)
> +                       {
> +                               fail("Link " + path + "is an AjaxLink and
> will " +
> +                                       "not be invoked when AJAX
> (javascript) is disabled.");
> +                       }
> +
> +                       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
>                  */
>                 else if (linkComponent instanceof SubmitLink)
>
>