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 2010/10/17 10:33:40 UTC
svn commit: r1023435 -
/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/
Author: mgrigorov
Date: Sun Oct 17 08:33:40 2010
New Revision: 1023435
URL: http://svn.apache.org/viewvc?rev=1023435&view=rev
Log:
WICKET-3111 TransparentWebMarkupContainer appears magically for html elements without 'wicket:id' but with 'href' attribute
Add test case for Panel with <a href="..."/> for which an auto component is added (TransparentWebMarkupContainer) and this causes that the any inner ComponentTags cannot be found with MarkupFragment#find(String childId)
Added:
wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.html (with props)
wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.java (with props)
wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.html (with props)
wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.java (with props)
wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent_ExpectedResult.html (with props)
Modified:
wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java
Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java?rev=1023435&r1=1023434&r2=1023435&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java Sun Oct 17 08:33:40 2010
@@ -28,6 +28,7 @@ import org.apache.wicket.markup.html.pan
import org.apache.wicket.markup.html.panel.InlinePanelPage_1;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.util.tester.DiffUtil;
+import org.junit.Ignore;
/**
*
@@ -42,12 +43,14 @@ public class MarkupFragmentTest extends
private void compare(IMarkupFragment markup, String testMarkup) throws IOException
{
- testMarkup = testMarkup.replaceAll("\n\r", "");
- testMarkup = testMarkup.replaceAll("\r\n", "");
+ testMarkup = testMarkup.replaceAll("\r", "");
+ testMarkup = testMarkup.replaceAll("\n", "");
+ testMarkup = testMarkup.replaceAll("\t", "");
String doc = markup.toString(true);
- doc = doc.replaceAll("\n\r", "");
- doc = doc.replaceAll("\r\n", "");
+ doc = doc.replaceAll("\n", "");
+ doc = doc.replaceAll("\r", "");
+ doc = doc.replaceAll("\t", "");
assertEquals(doc, testMarkup);
}
@@ -100,6 +103,39 @@ public class MarkupFragmentTest extends
}
/**
+ * @see WICKET-3111
+ *
+ * @throws Exception
+ */
+ @Ignore("Ignored until WICKET-3111 is fixed")
+ public void testPanelWithAutoComponent() throws Exception
+ {
+ Page page = new MyPage();
+ Panel panel = new MyPanelWithAutoComponent("panel");
+ page.add(panel);
+
+ // Get the associated markup file
+ IMarkupFragment markup = panel.getAssociatedMarkup();
+ compareWithFile(markup, "MyPanelWithAutoComponent_ExpectedResult.html");
+
+ // The Page is missing the tag to "call" the panel
+ assertNull(panel.getMarkup());
+
+ // Create a Page with proper markup for the panel
+ page = new MyPanelWithAutoComponentPage();
+ panel = (Panel)page.get("panel");
+
+ // getMarkup() returns the "calling" tags
+ markup = panel.getMarkup();
+ compare(markup, "<span wicket:id=\"panel\">test</span>");
+
+ // getMarkup(null) returns the markup which is used to find a child component
+ markup = panel.getMarkup(null);
+ compare(markup,
+ "<wicket:panel><a href=\"something\"><span wicket:id=\"label\">text</span></a></wicket:panel>");
+ }
+
+ /**
*
* @throws Exception
*/
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.html?rev=1023435&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.html (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.html Sun Oct 17 08:33:40 2010
@@ -0,0 +1,19 @@
+<!--
+ ====================================================================
+ Licensed 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.
+-->
+<wicket:panel>
+ <a href="something">
+ <span wicket:id="label">text</span>
+ </a>
+</wicket:panel>
Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.java?rev=1023435&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.java Sun Oct 17 08:33:40 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.markupFragments;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+
+
+/**
+ *
+ */
+public class MyPanelWithAutoComponent extends Panel
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ *
+ * @param id
+ */
+ public MyPanelWithAutoComponent(String id)
+ {
+ super(id);
+
+ add(new Label("label"));
+ }
+}
Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.html?rev=1023435&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.html (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.html Sun Oct 17 08:33:40 2010
@@ -0,0 +1,19 @@
+<!--
+ ====================================================================
+ Licensed 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.
+-->
+<html xmlns:wicket>
+<body>
+ <span wicket:id="panel">test</span>
+</body>
+</html>
Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.java?rev=1023435&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.java Sun Oct 17 08:33:40 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.markupFragments;
+
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ *
+ */
+public class MyPanelWithAutoComponentPage extends WebPage
+{
+ /**
+ * Construct.
+ */
+ public MyPanelWithAutoComponentPage()
+ {
+ add(new MyPanelWithAutoComponent("panel"));
+ }
+}
Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponentPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent_ExpectedResult.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent_ExpectedResult.html?rev=1023435&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent_ExpectedResult.html (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent_ExpectedResult.html Sun Oct 17 08:33:40 2010
@@ -0,0 +1,19 @@
+<!--
+ ====================================================================
+ Licensed 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.
+-->
+<wicket:panel>
+ <a href="something">
+ <span wicket:id="label">text</span>
+ </a>
+</wicket:panel>
Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelWithAutoComponent_ExpectedResult.html
------------------------------------------------------------------------------
svn:eol-style = native