use of org.apache.wicket.markup.IMarkupFragment in project wicket by apache.
the class MarkupFragmentTest method panelWithAutoComponent.
/**
* @see href http://issues.apache.org/jira/browse/WICKET-3111
*
* @throws Exception
*/
@Test
public void panelWithAutoComponent() throws Exception {
Page page = new MyPage();
Panel panel = new MyPanelWithAutoComponent("panel");
page.add(panel);
// Get the associated markup file
IMarkupFragment markup = panel.getAssociatedMarkup();
compareMarkupWithFile(markup, "MyPanelWithAutoComponent_ExpectedResult.html", MyPage.class);
// 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();
compareMarkupWithString(markup, "<span wicket:id=\"panel\">test</span>");
// getMarkup(null) returns the markup which is used to find a child component
markup = panel.getMarkup(null);
compareMarkupWithString(markup, "<wicket:panel><a href=\"something\"><span wicket:id=\"label\">text</span></a></wicket:panel>");
}
use of org.apache.wicket.markup.IMarkupFragment in project wicket by apache.
the class MarkupFragmentTest method border2.
/**
* @throws Exception
*/
@Test
public void border2() throws Exception {
Page page = new MyBorderPage();
Border border = (Border) page.get("border2");
// Get the associated markup file
IMarkupFragment markup = border.getAssociatedMarkup();
compareMarkupWithFile(markup, "MyBorder2_ExpectedResult.html", MyPage.class);
// getMarkup() returns the "calling" tags
markup = border.getMarkup();
compareMarkupWithString(markup, "<span wicket:id=\"border2\">test</span>");
// getMarkup(null) returns the markup which is used to find a child component
markup = border.getMarkup(null);
compareMarkupWithString(markup, "<wicket:border> 111 <wicket:body>333</wicket:body> 222</wicket:border>");
assertNull(border.getBodyContainer().getAssociatedMarkup());
// See explanation in BaseBorder.BorderBodyContainer.getMarkup()
border.dequeue();
markup = border.getBodyContainer().getParent().getMarkup(border.getBodyContainer());
compareMarkupWithString(markup, "<wicket:body>333</wicket:body>");
markup = border.getBodyContainer().getMarkup();
compareMarkupWithString(markup, "<wicket:body>333</wicket:body>");
// getMarkup(null) returns the markup which is used to find a child component
markup = border.getBodyContainer().getMarkup(null);
compareMarkupWithString(markup, "<span wicket:id=\"border2\">test</span>");
}
use of org.apache.wicket.markup.IMarkupFragment in project wicket by apache.
the class MarkupFragmentTest method page.
/**
* page.getAssociatedMarkup(), page.getMarkup() and page.getMarkup(null) must all return the
* same
*
* @throws Exception
*/
@Test
public void page() throws Exception {
IMarkupFragment markup = new MyPage().getAssociatedMarkup();
compareMarkupWithFile(markup, "MyPage_ExpectedResult.html", MyPage.class);
markup = new MyPage().getMarkup();
compareMarkupWithFile(markup, "MyPage_ExpectedResult.html", MyPage.class);
markup = new MyPage().getMarkup(null);
compareMarkupWithFile(markup, "MyPage_ExpectedResult.html", MyPage.class);
}
use of org.apache.wicket.markup.IMarkupFragment in project wicket by apache.
the class MarkupFragmentTest method panel.
/**
* @throws Exception
*/
@Test
public void panel() throws Exception {
Page page = new MyPage();
Panel panel = new MyPanel("panel");
page.add(panel);
// Get the associated markup file
IMarkupFragment markup = panel.getAssociatedMarkup();
compareMarkupWithFile(markup, "MyPanel_ExpectedResult.html", MyPage.class);
// The Page is missing the tag to "call" the panel
assertNull(panel.getMarkup());
// Create a Page with proper markup for the panel
page = new MyPanelPage();
panel = (Panel) page.get("panel");
// getMarkup() returns the "calling" tags
markup = panel.getMarkup();
compareMarkupWithString(markup, "<span wicket:id=\"panel\">test</span>");
// getMarkup(null) returns the markup which is used to find a child component, which in case
// of Panel is the <wicket:panel> tag and is thus may not be equal to the associated markup
// file.
markup = panel.getMarkup(null);
compareMarkupWithString(markup, "<wicket:panel> <span wicket:id=\"label\">text</span></wicket:panel>");
}
use of org.apache.wicket.markup.IMarkupFragment in project wicket by apache.
the class MarkupFragmentTest method label.
/**
* @throws Exception
*/
@Test
public void label() throws Exception {
Component label = new MyPage().get("label");
IMarkupFragment markup = label.getMarkup();
compareMarkupWithString(markup, "<span wicket:id=\"label\">text</span>");
label = new MyPanelPage().get("panel:label");
markup = label.getMarkup();
compareMarkupWithString(markup, "<span wicket:id=\"label\">text</span>");
}
Aggregations