use of org.apache.tapestry5.dom.DefaultMarkupModel in project tapestry-5 by apache.
the class AnyTest method render_simple.
@Test
public void render_simple() {
ComponentResources resources = mockComponentResources();
JavaScriptSupport support = mockJavaScriptSupport();
MarkupWriter writer = new MarkupWriterImpl(new DefaultMarkupModel());
resources.renderInformalParameters(writer);
replay();
Any component = new Any();
component.inject(support, resources, "span", "foo");
component.beginRender(writer);
writer.write("content");
component.afterRender(writer);
assertEquals(writer.toString(), "<span>content</span>");
verify();
}
use of org.apache.tapestry5.dom.DefaultMarkupModel in project tapestry-5 by apache.
the class AnyTest method render_with_id.
@Test
public void render_with_id() {
ComponentResources resources = mockComponentResources();
JavaScriptSupport support = mockJavaScriptSupport();
MarkupWriter writer = new MarkupWriterImpl(new DefaultMarkupModel());
resources.renderInformalParameters(writer);
String clientId = "bar";
String uniqueId = "bar_0";
expect(support.allocateClientId(clientId)).andReturn(uniqueId);
replay();
Any component = new Any();
component.inject(support, resources, "div", clientId);
component.beginRender(writer);
writer.write("content");
component.afterRender(writer);
assertEquals(writer.toString(), "<div>content</div>");
assertEquals(component.getClientId(), uniqueId);
assertEquals(writer.toString(), "<div id=\"bar_0\">content</div>");
assertEquals(component.getClientId(), uniqueId);
verify();
}
Aggregations