Repository: wicket
Updated Branches:
  refs/heads/master ce66c242a -> 73cc40108


WICKET-6289 fix autolinker so it does not generate an onclick attribute for img 
tags


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

Branch: refs/heads/master
Commit: ba0f578f53b158ff375e7de6dd7097c7ff93ac79
Parents: ce66c24
Author: Carl-Eric Menzel <cmen...@apache.org>
Authored: Fri Nov 25 15:16:31 2016 +0100
Committer: Carl-Eric Menzel <cmen...@apache.org>
Committed: Fri Nov 25 15:16:31 2016 +0100

----------------------------------------------------------------------
 .../markup/resolver/AutoLinkResolver.java       |   2 +-
 .../html/link/AutolinkPageExpectedResult_5.html |   9 +++++
 .../wicket/markup/html/link/AutolinkPage_5.html |   9 +++++
 .../wicket/markup/html/link/AutolinkPage_5.java |  36 +++++++++++++++++++
 .../wicket/markup/html/link/AutolinkTest.java   |   7 ++++
 .../markup/html/link/subdir/apache-wicket.png   | Bin 0 -> 210963 bytes
 6 files changed, 62 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ba0f578f/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
index 37527c0..7ff5f87 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
@@ -900,7 +900,7 @@ public final class AutoLinkResolver implements 
IComponentResolver
                        // resolving didn't have the desired result or there 
was no delegate
                        // found; fallback on the default resolving which is a 
simple
                        // component that leaves the tag unchanged
-                       autoComponent = new AutolinkExternalLink(componentId, 
pathInfo.reference);
+                       autoComponent = new WebMarkupContainer(componentId);
                }
 
                return autoComponent;

http://git-wip-us.apache.org/repos/asf/wicket/blob/ba0f578f/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
new file mode 100644
index 0000000..a8462cc
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
@@ -0,0 +1,9 @@
+<html xmlns:wicket>
+<body>
+<wicket:link autolink="true">
+  <img 
src="../resource/org.apache.wicket.markup.html.link.AutolinkPage_5/subdir/apache-wicket.png"/>
+  <!-- image does not exist => Do not change at all -->
+  <img src="does-not-exist.png"/>
+</wicket:link>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ba0f578f/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
new file mode 100644
index 0000000..c135a95
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
@@ -0,0 +1,9 @@
+<html xmlns:wicket>
+<body>
+<wicket:link autolink=true>
+  <img src="subdir/apache-wicket.png"/>
+  <!-- image does not exist => Do not change at all -->
+  <img src="does-not-exist.png"/>
+</wicket:link>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ba0f578f/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
new file mode 100644
index 0000000..f88db08
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.wicket.markup.html.link;
+
+
+import org.apache.wicket.markup.html.WebPage;
+
+
+/**
+ * Mock page for testing.
+ */
+public class AutolinkPage_5 extends WebPage
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * Construct.
+        */
+       public AutolinkPage_5()
+       {
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ba0f578f/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
index 8f20ce2..31512ed 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
@@ -68,4 +68,11 @@ public class AutolinkTest extends WicketTestCase
                
tester.getApplication().getMarkupSettings().setAutomaticLinking(true);
                executeTest(AutolinkPage_4.class, 
"AutolinkPageExpectedResult_4.html");
        }
+
+       @Test
+       public void imgTagsShouldNotGetOnClick() throws Exception
+       {
+               
tester.getApplication().getMarkupSettings().setAutomaticLinking(true);
+               executeTest(AutolinkPage_5.class, 
"AutolinkPageExpectedResult_5.html");
+       }
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/ba0f578f/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
new file mode 100644
index 0000000..7d4d922
Binary files /dev/null and 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
 differ

Reply via email to