Author: mgrigorov
Date: Mon May 16 08:25:58 2011
New Revision: 1103644
URL: http://svn.apache.org/viewvc?rev=1103644&view=rev
Log:
WICKET-3719 Component's markup cannot be found in Ajax requests if the parent
is transparent
Add a test case that reproduces the problem described in this ticket
Added:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.html
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.java
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.html
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.java
Modified:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
Modified:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java?rev=1103644&r1=1103643&r2=1103644&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
(original)
+++
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
Mon May 16 08:25:58 2011
@@ -17,13 +17,16 @@
package org.apache.wicket.markup.html;
import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
import org.apache.wicket.WicketTestCase;
import org.apache.wicket.markup.IMarkupResourceStreamProvider;
import org.apache.wicket.markup.MarkupException;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.border.Border;
+import org.apache.wicket.util.lang.WicketObjects;
import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.resource.StringResourceStream;
+import org.apache.wicket.util.tester.WicketTester;
/**
* @author Pedro Santos
@@ -83,6 +86,28 @@ public class TransparentWebMarkupContain
assertTrue(tester.getLastResponseAsString().contains(expected));
}
+ /**
+ * Test case for <a
href="https://issues.apache.org/jira/browse/WICKET-3719">WICKET-3719</a>
+ */
+ public void bug_testAjaxUpdate()
+ {
+ WicketTester wicketTester = new WicketTester()
+ {
+ @Override
+ public Page getLastRenderedPage()
+ {
+ // emulate serialization of the page so the
components
+ // loose their "private transient Markup
markup" and Component.getMarkup() use
+ // the respective MarkupSourcingStrategy
+ Page lastRenderedPage =
super.getLastRenderedPage();
+ return
(Page)WicketObjects.cloneObject(lastRenderedPage);
+ }
+ };
+
+ wicketTester.startPage(TransparentWithAjaxUpdatePage.class);
+ wicketTester.clickLink("link", true);
+ }
+
/** */
public static class TestPage extends WebPage implements
IMarkupResourceStreamProvider
{
Added:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.html?rev=1103644&view=auto
==============================================================================
---
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.html
(added)
+++
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.html
Mon May 16 08:25:58 2011
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html wicket:id="html-tag"">
+
+ <head>
+ <title>A page</title>
+ </head>
+
+ <body>
+
+ <div wicket:id="panel">blah</div>
+ <a wicket:id="link">Update</a>
+ </body>
+
+</html>
\ No newline at end of file
Added:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.java?rev=1103644&view=auto
==============================================================================
---
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.java
(added)
+++
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePage.java
Mon May 16 08:25:58 2011
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+/**
+ * Test page for <a
href="https://issues.apache.org/jira/browse/WICKET-3719">WICKET-3719</a>
+ *
+ * @see TransparentWebMarkupContainerTest#testAjaxUpdate()
+ */
+public class TransparentWithAjaxUpdatePage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ *
+ * @param parameters
+ */
+ public TransparentWithAjaxUpdatePage(PageParameters parameters)
+ {
+ super(parameters);
+
+ add(new TransparentWebMarkupContainer("html-tag"));
+
+ final TransparentWithAjaxUpdatePanel panel = new
TransparentWithAjaxUpdatePanel("panel");
+ add(panel);
+
+ add(new AjaxLink<Void>("link")
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onClick(AjaxRequestTarget target)
+ {
+ target.add(panel);
+ }
+ });
+ }
+}
Added:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.html?rev=1103644&view=auto
==============================================================================
---
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.html
(added)
+++
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.html
Mon May 16 08:25:58 2011
@@ -0,0 +1,3 @@
+<wicket:panel>
+ panel content
+</wicket:panel>
\ No newline at end of file
Added:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.java?rev=1103644&view=auto
==============================================================================
---
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.java
(added)
+++
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWithAjaxUpdatePanel.java
Mon May 16 08:25:58 2011
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import org.apache.wicket.markup.html.panel.Panel;
+
+class TransparentWithAjaxUpdatePanel extends Panel
+{
+ private static final long serialVersionUID = 1L;
+
+ public TransparentWithAjaxUpdatePanel(String id)
+ {
+ super(id);
+ setOutputMarkupId(true);
+ }
+
+}
\ No newline at end of file