You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/07/09 15:00:57 UTC

git commit: WICKET-4644 AjaxFallbackLink still renders inline.javascript

Updated Branches:
  refs/heads/master 2ee29c0f1 -> 73d5552c5


WICKET-4644 AjaxFallbackLink still renders inline.javascript


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

Branch: refs/heads/master
Commit: 73d5552c5ff3e9faf2c6c00fdfa71a131399c04e
Parents: 2ee29c0f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jul 9 15:59:57 2012 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Jul 9 15:59:57 2012 +0300

----------------------------------------------------------------------
 .../wicket/ajax/markup/html/AjaxFallbackLink.java  |    2 +-
 .../ajax/markup/html/AjaxFallbackLinkTest.java     |   64 +++++++++++++++
 2 files changed, 65 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/73d5552c/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
index 15e3cb0..702fdc8 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
@@ -33,7 +33,7 @@ import org.apache.wicket.model.IModel;
  * otherwise the 'href' attribute if the markup element is an &lt;a&gt;, &lt;area&gt; or &lt;link&gt;.
  * AjaxFallbackLink doesn't fallback if the markup element is none of the three above.
  * </p>
- * 
+ *
  * @since 1.2
  * 
  * @author Igor Vaynberg (ivaynberg)

http://git-wip-us.apache.org/repos/asf/wicket/blob/73d5552c/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLinkTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLinkTest.java b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLinkTest.java
new file mode 100644
index 0000000..0c0e5c9
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLinkTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.ajax.markup.html;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.IMarkupResourceStreamProvider;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.util.resource.IResourceStream;
+import org.apache.wicket.util.resource.StringResourceStream;
+import org.junit.Test;
+
+/**
+ * @since 6.0.0
+ */
+public class AjaxFallbackLinkTest extends WicketTestCase
+{
+	/**
+	 * Tests that AjaxFallbackLink doesn't produce onclick inline attribute for non-anchor markup elements
+	 *
+	 * https://issues.apache.org/jira/browse/WICKET-4644
+	 */
+	@Test
+	public void noInlineOnClickAttribute()
+	{
+		tester.startPage(new AjaxFallbackLinkPage());
+		tester.assertContainsNot("onclick=");
+	}
+
+	private static class AjaxFallbackLinkPage extends WebPage implements IMarkupResourceStreamProvider
+	{
+		private AjaxFallbackLinkPage()
+		{
+			add(new AjaxFallbackLink("l") {
+
+				@Override
+				public void onClick(AjaxRequestTarget target)
+				{
+				}
+			});
+		}
+
+		@Override
+		public IResourceStream getMarkupResourceStream(MarkupContainer container, Class<?> containerClass)
+		{
+			return new StringResourceStream("<html><body><bla wicket:id='l'>Ajax fallback link</bla></body></html>");
+		}
+	}
+}