use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testMakeTreeItemElement.
@Test
public void testMakeTreeItemElement() {
final DecisionNavigatorItem item = makeItem("uuid");
final DecisionNavigatorTreeView.TreeItem newTreeItem = mock(DecisionNavigatorTreeView.TreeItem.class);
final DecisionNavigatorTreeView.TreeItem treeItem = mock(DecisionNavigatorTreeView.TreeItem.class);
final Element childrenTree = mock(Element.class);
final HTMLElement htmlElement = mock(HTMLElement.class);
final elemental2.dom.HTMLElement expectedHtmlElement = mock(elemental2.dom.HTMLElement.class);
doReturn(childrenTree).when(treeView).makeTree(item.getChildren());
when(managedInstance.get()).thenReturn(newTreeItem);
when(newTreeItem.setup(item, childrenTree)).thenReturn(treeItem);
when(treeItem.getElement()).thenReturn(htmlElement);
when(util.asHTMLElement(htmlElement)).thenReturn(expectedHtmlElement);
final Element actualHtmlElement = treeView.makeTreeItemElement(item);
assertEquals(expectedHtmlElement, actualHtmlElement);
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemGetCSSClass.
@Test
public void testTreeItemGetCSSClass() {
final String uuid = "uuid";
final String label = "label";
final DecisionNavigatorItem.Type subItem = CONTEXT;
final Command onClick = () -> {
/* Nothing. */
};
final String expectedCSSClass = "kie-context";
final DecisionNavigatorItem item = new DecisionNavigatorItemBuilder().withUUID(uuid).withLabel(label).withType(subItem).withOnClick(onClick).build();
final String actualCSSClass = treeItem.getCSSClass(item);
assertEquals(expectedCSSClass, actualCSSClass);
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemOnTextContentClick.
@Test
public void testTreeItemOnTextContentClick() {
final ClickEvent event = mock(ClickEvent.class);
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
doReturn(item).when(treeItem).getItem();
treeItem.onTextContentClick(event);
verify(item).onClick();
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorItemFactoryTest method testGetOnUpdate.
@Test
public void testGetOnUpdate() {
final DMNDiagramElement dmnDiagramElement = mock(DMNDiagramElement.class);
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final Name dmnDiagramElementName = new Name();
final String newDiagramName = "New diagram name";
when(item.getLabel()).thenReturn(newDiagramName);
when(dmnDiagramElement.getName()).thenReturn(dmnDiagramElementName);
factory.getOnUpdate(dmnDiagramElement).accept(item);
verify(selectedEvent).fire(diagramSelectedArgumentCaptor.capture());
final DMNDiagramElement actualDiagram = diagramSelectedArgumentCaptor.getValue().getDiagramElement();
assertEquals(dmnDiagramElement, actualDiagram);
assertEquals(newDiagramName, actualDiagram.getName().getValue());
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorItemFactoryTest method testMakeSeparator.
@Test
public void testMakeSeparator() {
final String drds = "DRDs";
final DecisionNavigatorItem drdSeparator = factory.makeSeparator(drds);
assertEquals(drds, drdSeparator.getLabel());
assertEquals(SEPARATOR, drdSeparator.getType());
assertNotNull(drdSeparator.getUUID());
assertNull(drdSeparator.getParentUUID());
}
Aggregations