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

wicket git commit: test for WICKET-5941

Repository: wicket
Updated Branches:
  refs/heads/master 9618e7024 -> 2e5da6d26


test for WICKET-5941


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

Branch: refs/heads/master
Commit: 2e5da6d26aa2a935d6644e5b15c194bbe5dae8bc
Parents: 9618e70
Author: Andrea Del Bene <ad...@apache.org>
Authored: Mon Jul 13 23:22:00 2015 +0200
Committer: Andrea Del Bene <ad...@apache.org>
Committed: Mon Jul 13 23:22:00 2015 +0200

----------------------------------------------------------------------
 .../html/TransparentWebMarkupContainerTest.java | 56 ++++++++++++++++++++
 1 file changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/2e5da6d2/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
index 6b3bd5f..41bff97 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
@@ -16,8 +16,11 @@
  */
 package org.apache.wicket.markup.html;
 
+import org.apache.wicket.Component;
 import org.apache.wicket.IPageManagerProvider;
 import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.core.util.lang.WicketObjects;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.MarkupException;
@@ -29,6 +32,7 @@ import org.apache.wicket.page.IPageManager;
 import org.apache.wicket.page.IPageManagerContext;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
+import org.apache.wicket.util.tester.TagTester;
 import org.apache.wicket.util.tester.WicketTestCase;
 import org.apache.wicket.util.tester.WicketTester;
 import org.junit.Test;
@@ -227,6 +231,24 @@ public class TransparentWebMarkupContainerTest extends WicketTestCase
 		tester.assertComponentOnAjaxResponse("label");
 	}
 
+	/**
+	 * https://issues.apache.org/jira/browse/WICKET-5941
+	 * 
+	 * Headers not rendered for components inside TransparentWebMarkupContainer on ajax update
+	 */
+	@Test
+	public void updateEmbeddedAjaxComponent() throws Exception
+	{
+		tester.startPage(TestEmbeddedAjaxComponet.class);
+		tester.clickLink("ajaxLink", true);
+		
+		TagTester scriptTag = TagTester.createTagByAttribute(
+			tester.getLastResponseAsString(), "header-contribution");
+		
+		//check if our response contains headers
+		assertNotNull(scriptTag);
+	}
+	
 	/** */
 	public static class TestPage extends WebPage implements IMarkupResourceStreamProvider
 	{
@@ -323,4 +345,38 @@ public class TransparentWebMarkupContainerTest extends WicketTestCase
 				"</body></html>");
 		}
 	}
+	
+	public static class TestEmbeddedAjaxComponet extends WebPage implements IMarkupResourceStreamProvider
+	{
+		private static final long serialVersionUID = 1L;
+
+		/** */
+		public TestEmbeddedAjaxComponet()
+		{
+			final Component container;
+			add(container = new TransparentWebMarkupContainer("container")
+					.setOutputMarkupId(true));
+			add(new AjaxLink<Void>("ajaxLink"){
+
+				@Override
+				public void onClick(AjaxRequestTarget target)
+				{
+					target.add(container);
+				}
+				
+			});
+		}
+
+		@Override
+		public IResourceStream getMarkupResourceStream(MarkupContainer container,
+			Class<?> containerClass)
+		{
+			return new StringResourceStream("" + //
+				"<html><body>" + //
+				"	<div wicket:id=\"container\">" + //
+				"		<a wicket:id=\"ajaxLink\"></a>" + //
+				"	</div>" + //
+				"</body></html>");
+		}
+	}
 }