use of org.apache.tapestry5.annotations.Component in project tapestry-5 by apache.
the class OutputTest method output_with_element_and_informals.
@Test
public void output_with_element_and_informals() {
String elementName = "span";
MarkupWriter writer = createMarkupWriter();
ComponentResources resources = mockComponentResources();
train_renderInformalParameters(resources, writer, "foo", "bar");
replay();
Output component = new Output();
component.setup(value, format, true, elementName, resources);
assertFalse(component.beginRender(writer));
verify();
assertEquals(writer.toString(), "<span foo=\"bar\">22.70</span>");
}
use of org.apache.tapestry5.annotations.Component in project tapestry-5 by apache.
the class OutputTest method simple_output_with_filter_disabled.
@Test
public void simple_output_with_filter_disabled() {
MarkupWriter writer = createMarkupWriter();
ComponentResources resources = mockComponentResources();
replay();
Output component = new Output();
component.setup(value, filterFormat, false, null, resources);
writer.element("root");
assertFalse(component.beginRender(writer));
writer.end();
verify();
// It's not valid XML output, but that's why it's called programmer error :-)
assertEquals(writer.toString(), "<root><22.70></root>");
}
use of org.apache.tapestry5.annotations.Component in project tapestry-5 by apache.
the class OutputTest method simple_output_with_filter.
@Test
public void simple_output_with_filter() {
MarkupWriter writer = createMarkupWriter();
ComponentResources resources = mockComponentResources();
replay();
Output component = new Output();
component.setup(value, filterFormat, true, null, resources);
writer.element("root");
assertFalse(component.beginRender(writer));
writer.end();
verify();
assertEquals(writer.toString(), "<root><22.70></root>");
}
use of org.apache.tapestry5.annotations.Component in project tapestry-5 by apache.
the class OutputTest method null_format_is_a_noop.
@Test
public void null_format_is_a_noop() {
String elementName = "span";
MarkupWriter writer = createMarkupWriter();
ComponentResources resources = mockComponentResources();
Format format = new Format() {
private static final long serialVersionUID = -4360045992642727894L;
@Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
return toAppendTo;
}
@Override
public Object parseObject(String source, ParsePosition pos) {
return null;
}
};
replay();
Output component = new Output();
component.setup(value, format, true, elementName, resources);
writer.element("root");
assertFalse(component.beginRender(writer));
writer.end();
verify();
assertEquals(writer.toString(), "<root></root>");
}
use of org.apache.tapestry5.annotations.Component 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();
}
Aggregations