I've added some more tests to show that it is workong correctly. The point with <span /> is that OpenCloseTagExpander automatically opens certain tags.
Juergen On Mon, Mar 31, 2008 at 9:07 PM, Gerolf Seitz <[EMAIL PROTECTED]> wrote: > i'm afraid the fix doesn't really address the reported issue, > because the tag type isn't changed from open-close to open-body-close. > > also, changing <span wicket:id="a"/> to <test wicket:id="a"></test> works, > while transforming <test wicket:id="b"/> to <span wicket:id="b"></span> > doesn't > produce the right output. (</span> is written after </html>) > > Gerolf > > > > On Mon, Mar 31, 2008 at 6:26 PM, <[EMAIL PROTECTED]> wrote: > > > Author: jdonnerstag > > Date: Mon Mar 31 09:26:37 2008 > > New Revision: 643048 > > > > URL: http://svn.apache.org/viewvc?rev=643048&view=rev > > Log: > > fixed wicket-1458: Changing tag name and expanding open-close to > > open-body-close prints old tag name > > > > Added: > > wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html > > wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.html > > wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.java > > Modified: > > wicket/trunk/jdk-1.4 > > /wicket/src/main/java/org/apache/wicket/Component.java > > wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java > > > > Modified: wicket/trunk/jdk-1.4 > > /wicket/src/main/java/org/apache/wicket/Component.java > > URL: > > > http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java?rev=643048&r1=643047&r2=643048&view=diff > > > > > ============================================================================== > > --- > wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java > > (original) > > +++ > wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java > > Mon Mar 31 09:26:37 2008 > > @@ -2487,7 +2487,7 @@ > > } > > else > > { > > - // If a open-close tag has been to > > modified to be > > + // If a open-close tag has been > > modified to be > > // open-body-close than a synthetic > > close tag must be > > // rendered. > > if (getRenderBodyOnly() == false) > > @@ -2500,8 +2500,9 @@ > > > > if (!(openTag instanceof > > WicketTag) || !stripWicketTags) > > { > > - // Close the > > manually opened panel tag. > > - > > getResponse().write(openTag.syntheticCloseTagString()); > > + // Close the > > manually opened tag. And since the > > + // user might have > > changed the tag name ... > > + > > getResponse().write(tag.syntheticCloseTagString()); > > } > > } > > } > > > > Added: wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html > > URL: > > > http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html?rev=643048&view=auto > > > > > ============================================================================== > > --- > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html > > (added) > > +++ > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html > > Mon Mar 31 09:26:37 2008 > > @@ -0,0 +1,5 @@ > > +<html xmlns:wicket> > > +<body> > > + <test wicket:id="myContainer">test</test> > > +</body> > > +</html> > > > > Modified: wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java > > URL: > > > http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java?rev=643048&r1=643047&r2=643048&view=diff > > > > > ============================================================================== > > --- > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java > > (original) > > +++ > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java > > Mon Mar 31 09:26:37 2008 > > @@ -77,8 +77,8 @@ > > document = tester.getServletResponse().getDocument(); > > assertNotNull(document); > > assertEquals( > > - "<wicket:panel>Inside the panel<span > > wicket:id=\"label\">mein Label</span></wicket:panel>", > > - document); > > + "<wicket:panel>Inside the panel<span > > wicket:id=\"label\">mein Label</span></wicket:panel>", > > + document); > > > > label = > > (Label)tester.getLastRenderedPage().get("myPanel:label"); > > assertNotNull(label); > > @@ -95,8 +95,8 @@ > > assertNotNull(document); > > assertFalse("".equals(document)); > > assertEquals( > > - "<wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border>", > > - document); > > + "<wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border>", > > + document); > > > > border = > > (Border)tester.getLastRenderedPage().get("myBorder2"); > > assertNotNull(border); > > @@ -105,8 +105,8 @@ > > assertNotNull(document); > > assertFalse("".equals(document)); > > assertEquals( > > - "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > - document); > > + "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > + document); > > > > // do the same test twice. Igor reported a problem with > > that, so we have to test it. > > border = > > (Border)tester.getLastRenderedPage().get("myBorder2"); > > @@ -116,8 +116,8 @@ > > assertNotNull(document); > > assertFalse("".equals(document)); > > assertEquals( > > - "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > - document); > > + "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > + document); > > > > WebMarkupContainer container = > > (WebMarkupContainer)tester.getLastRenderedPage().get("test"); > > assertNotNull(container); > > @@ -157,8 +157,8 @@ > > document = tester.getServletResponse().getDocument(); > > assertNotNull(document); > > assertEquals( > > - "<wicket:panel>Inside the panel<span > > wicket:id=\"label\">mein Label</span></wicket:panel>", > > - document); > > + "<wicket:panel>Inside the panel<span > > wicket:id=\"label\">mein Label</span></wicket:panel>", > > + document); > > > > label = (Label)page.get("myPanel:label"); > > assertNotNull(label); > > @@ -175,8 +175,8 @@ > > assertNotNull(document); > > assertFalse("".equals(document)); > > assertEquals( > > - "<wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border>", > > - document); > > + "<wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border>", > > + document); > > > > border = (Border)page.get("myBorder2"); > > assertNotNull(border); > > @@ -185,8 +185,8 @@ > > assertNotNull(document); > > assertFalse("".equals(document)); > > assertEquals( > > - "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > - document); > > + "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > + document); > > > > // do the same test twice. Igor reported a problem with > > that, so we have to test it. > > border = (Border)page.get("myBorder2"); > > @@ -196,8 +196,8 @@ > > assertNotNull(document); > > assertFalse("".equals(document)); > > assertEquals( > > - "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > - document); > > + "<span wicket:id=\"myBorder2\" > > testAttr=\"myValue\"><wicket:border>before body - > > <wicket:body>border</wicket:body> - after body</wicket:border></span>", > > + document); > > > > WebMarkupContainer container = > > (WebMarkupContainer)page.get("test"); > > assertNotNull(container); > > @@ -392,8 +392,8 @@ > > String document = tester.getServletResponse > > ().getDocument(); > > assertNotNull(document); > > assertEquals( > > - "<wicket:panel>Inside the panel<span > > wicket:id=\"label\">mein Label</span></wicket:panel>", > > - document); > > + "<wicket:panel>Inside the panel<span > > wicket:id=\"label\">mein Label</span></wicket:panel>", > > + document); > > } > > > > /** > > @@ -434,5 +434,13 @@ > > public void testRenderHomePage_15() throws Exception > > { > > executeTest(SimplePage_15.class, > > "SimplePageExpectedResult_15.html"); > > + } > > + > > + /** > > + * @throws Exception > > + */ > > + public void testRenderHomePage_16() throws Exception > > + { > > + executeTest(SimplePage_16.class, > > "SimplePageExpectedResult_16.html"); > > } > > } > > > > Added: wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.html > > URL: > > > http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.html?rev=643048&view=auto > > > > > ============================================================================== > > --- > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.html > > (added) > > +++ > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.html > > Mon Mar 31 09:26:37 2008 > > @@ -0,0 +1,5 @@ > > +<html xmlns:wicket> > > +<body> > > + <span wicket:id="myContainer">test</span> > > +</body> > > +</html> > > > > Added: wicket/trunk/jdk-1.4 > > > /wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.java > > URL: > > > http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.java?rev=643048&view=auto > > > > > ============================================================================== > > --- > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.java > > (added) > > +++ > wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_16.java > > Mon Mar 31 09:26:37 2008 > > @@ -0,0 +1,49 @@ > > +/* > > + * 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.basic; > > + > > +import org.apache.wicket.markup.ComponentTag; > > +import org.apache.wicket.markup.html.WebMarkupContainer; > > +import org.apache.wicket.markup.html.WebPage; > > + > > + > > +/** > > + * Mock page for testing. > > + * > > + */ > > +public class SimplePage_16 extends WebPage > > +{ > > + private static final long serialVersionUID = 1L; > > + > > + /** > > + * Construct. > > + */ > > + public SimplePage_16() > > + { > > + add(new WebMarkupContainer("myContainer") > > + { > > + private static final long serialVersionUID = 1L; > > + > > + protected void onComponentTag(ComponentTag tag) > > + { > > + tag.setName("test"); > > + > > + super.onComponentTag(tag); > > + } > > + }); > > + } > > +} > > > > > > >
