use of org.apache.tapestry5.internal.structure.ComponentPageElement in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method render_an_informal_parameter.
@Test
public void render_an_informal_parameter() {
ComponentPageElement element = mockComponentPageElement();
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
MarkupWriter writer = mockMarkupWriter();
ComponentModel model = mockComponentModel();
Binding binding = mockBinding();
Object rawValue = new Long(97);
train_getModel(ins, model);
train_getParameterModel(model, "fred", null);
train_get(binding, rawValue);
writer.attributes("fred", "97");
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(null, element, null, elementResources, "Foo.bar", null, ins, false);
resources.bindParameter("fred", binding);
resources.renderInformalParameters(writer);
verify();
}
use of org.apache.tapestry5.internal.structure.ComponentPageElement in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method get_property_name_internal_prop_binding.
@Test
public void get_property_name_internal_prop_binding() {
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
ComponentModel model = mockComponentModel();
ComponentPageElement element = mockComponentPageElement();
Page page = mockPage();
InternalPropBinding binding = newMock(InternalPropBinding.class);
train_getModel(ins, model);
expect(binding.getPropertyName()).andReturn("foo");
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(page, element, null, null, null, null, ins, false);
resources.bindParameter("bar", binding);
assertEquals(resources.getPropertyName("bar"), "foo");
verify();
}
use of org.apache.tapestry5.internal.structure.ComponentPageElement in project tapestry-5 by apache.
the class PageImplTest method accessor_methods.
@Test
public void accessor_methods() {
ComponentPageElement root = mockComponentPageElement();
ComponentResourceSelector selector = new ComponentResourceSelector(Locale.ENGLISH);
MetaDataLocator locator = newMetaDataLocator(LOGICAL_PAGE_NAME, true);
replay();
Page page = new PageImpl(LOGICAL_PAGE_NAME, selector, null, perThreadManager, locator);
assertNull(page.getRootElement());
page.setRootElement(root);
assertSame(page.getSelector(), selector);
assertSame(page.getRootElement(), root);
assertSame(page.getName(), LOGICAL_PAGE_NAME);
assertTrue(page.isExactParameterCountMatch());
verify();
}
use of org.apache.tapestry5.internal.structure.ComponentPageElement in project tapestry-5 by apache.
the class PageImplTest method get_by_nested_id_for_blank_value_returns_root_component.
@Test
public void get_by_nested_id_for_blank_value_returns_root_component() {
ComponentPageElement root = mockComponentPageElement();
MetaDataLocator locator = newMetaDataLocator(LOGICAL_PAGE_NAME, true);
replay();
Page page = new PageImpl(LOGICAL_PAGE_NAME, selector, null, perThreadManager, locator);
page.setRootElement(root);
assertSame(page.getComponentElementByNestedId(""), root);
verify();
}
Aggregations