use of com.github.bordertech.wcomponents.TestAction in project wcomponents by BorderTech.
the class WLinkRenderer_Test method testDoPaintWithAction.
@Test
public void testDoPaintWithAction() throws IOException, SAXException, XpathException {
WContainer root = new WContainer();
WLink link = new WLink("test", "http://test");
WPanel target1 = new WPanel();
WPanel target2 = new WPanel();
root.add(link);
root.add(target1);
root.add(target2);
// No Targets (target itself)
link.setAction(new TestAction());
assertSchemaMatch(root);
assertXpathEvaluatesTo(link.getId(), "//ui:ajaxtrigger/@triggerId", root);
assertXpathEvaluatesTo("1", "count(//ui:ajaxtrigger/ui:ajaxtargetid)", root);
assertXpathEvaluatesTo(link.getId(), "//ui:ajaxtrigger/ui:ajaxtargetid[1]/@targetId", root);
// With Targets
link.setAction(new TestAction(), target1, target2);
assertSchemaMatch(root);
assertXpathEvaluatesTo(link.getId(), "//ui:ajaxtrigger/@triggerId", root);
assertXpathEvaluatesTo("2", "count(//ui:ajaxtrigger/ui:ajaxtargetid)", root);
assertXpathEvaluatesTo(target1.getId(), "//ui:ajaxtrigger/ui:ajaxtargetid[1]/@targetId", root);
assertXpathEvaluatesTo(target2.getId(), "//ui:ajaxtrigger/ui:ajaxtargetid[2]/@targetId", root);
}
use of com.github.bordertech.wcomponents.TestAction in project wcomponents by BorderTech.
the class WMenuItemRenderer_Test method testAction.
@Test
public void testAction() throws IOException, SAXException, XpathException {
// Test with action
WMenuItem item = new WMenuItem(itemText, new TestAction());
WMenu wrapped = wrapMenuItem(item);
assertSchemaMatch(wrapped);
assertXpathEvaluatesTo(itemText, "normalize-space(//ui:menuitem/ui:decoratedlabel)", item);
assertXpathNotExists("//ui:menuitem/@url", item);
assertXpathEvaluatesTo("true", "//ui:menuitem/@submit", item);
}
Aggregations