[
https://issues.apache.org/jira/browse/WICKET-5989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Grigorov resolved WICKET-5989.
-------------------------------------
Resolution: Fixed
Fix Version/s: 7.1.0
6.21.0
> BaseWicketTester#startComponentInPage fails for pages with
> <wicket:header-items></wicket:header> placeholder
> ------------------------------------------------------------------------------------------------------------
>
> Key: WICKET-5989
> URL: https://issues.apache.org/jira/browse/WICKET-5989
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.20.0
> Environment: Windows 7, Java 7
> Reporter: Ephraim Rosenfeld
> Assignee: Martin Grigorov
> Fix For: 6.21.0, 7.1.0
>
> Attachments: myproject.zip
>
>
> I am using the
> {{[BaseWicketTester.html#startComponentInPage(C)|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/util/tester/BaseWicketTester.html#startComponentInPage(C)]}}
> to validate individual components/panels.
> I am overriding the
> {{[BaseWicketTester.html#createPage()|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/util/tester/BaseWicketTester.html#createPage()]}}
> and
> {{[BaseWicketTester.html#createPageMarkup(java.lang.String)|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/util/tester/BaseWicketTester.html#createPageMarkup(java.lang.String)]}}
> methods to return a dummy page that contains a placeholder for
> components-to-be-tested. The dummy page extends my base page class.
> My base page class makes use of the
> [<wicket:header-items/>|https://cwiki.apache.org/confluence/display/WICKET/Wicket's+XHTML+tags#Wicket'sXHTMLtags-Elementwicket:header-items]
> placeholder tag.
> When attempting to use
> {{[BaseWicketTester.html#createPage()|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/util/tester/BaseWicketTester.html#createPage()]}}
> method, the method fails with the following error message:
> |Error while parsing the markup for the autogenerated page: More than one
> <wicket:header-items/> detected in the <head> element. Only one is allowed.
> If I remove the
> {{[<wicket:header-items/>|https://cwiki.apache.org/confluence/display/WICKET/Wicket's+XHTML+tags#Wicket'sXHTMLtags-Elementwicket:header-items]}}
> placeholder tag from my base page class, the test runs successfully.
> The test only fails when using the
> {{[BaseWicketTester.html#startComponentInPage(C)|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/util/tester/BaseWicketTester.html#startComponentInPage(C)]}},
> which only accepts one argument. If I use the
> {{[BaseWicketTester.html#startComponentInPage(C,
> org.apache.wicket.markup.IMarkupFragment)|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/util/tester/BaseWicketTester.html#startComponentInPage(C,
> org.apache.wicket.markup.IMarkupFragment)]}} and pass in the
> {{MarkupFragment}} of the test class as the second argument, then the test
> runs successfully, e.g.
> {code}
> tester.startComponentInPage(new MyPanel(DummyPanelPage.TEST_PANEL_ID), new
> MyDummyPanelPage(new PageParameters()).getMarkup());
> {code}
> It would seem that the
> {{[<wicket:header-items/>|https://cwiki.apache.org/confluence/display/WICKET/Wicket's+XHTML+tags#Wicket'sXHTMLtags-Elementwicket:header-items]}}
> placeholder tag clashes with the
> {{[ContainerInfo|https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/markup/ContainerInfo.html]}}
> class used by the testing framework, but this is by no means my area of
> expertise.
> I am attaching a quick-start app with a {{TestHomePage}} test class that
> reproduces the issue.
> Thank you in advance!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)