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());
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemInitOuiaAttributes.
@Test
public void testTreeItemInitOuiaAttributes() {
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final Text textNode = mock(Text.class);
final String label = "label";
final HTMLElement element = mock(HTMLElement.class);
doReturn(element).when(treeItem).getElement();
doReturn(item).when(treeItem).getItem();
doReturn(DECISION).when(item).getType();
doReturn(textNode).when(treeItem).getTextNode(label);
when(item.getLabel()).thenReturn(label);
treeItem.initOuiaComponentAttributes();
verify(element).setAttribute(OuiaComponentTypeAttribute.COMPONENT_TYPE, "dmn-graph-navigator-decision");
verify(element).setAttribute(OuiaComponentIdAttribute.COMPONENT_ID, "dmn-graph-navigator-decision-label");
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testOnRemoveClick.
@Test
public void testOnRemoveClick() {
final HTMLElement element = mock(HTMLElement.class);
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final ClickEvent event = mock(ClickEvent.class);
final org.jboss.errai.common.client.dom.DOMTokenList tokenList = mock(org.jboss.errai.common.client.dom.DOMTokenList.class);
doReturn(element).when(treeItem).getElement();
doReturn(item).when(treeItem).getItem();
when(element.getClassList()).thenReturn(tokenList);
treeItem.onRemoveClick(event);
verify(item).onRemove();
verify(locker).fire(any());
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemUpdateCSSClassWhenItemDoesNotHaveChildren.
@Test
public void testTreeItemUpdateCSSClassWhenItemDoesNotHaveChildren() {
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final org.jboss.errai.common.client.dom.DOMTokenList classList = mock(org.jboss.errai.common.client.dom.DOMTokenList.class);
final HTMLElement element = mock(HTMLElement.class);
final String cssClass = "css-class";
doReturn(item).when(treeItem).getItem();
doReturn(element).when(treeItem).getElement();
doReturn(cssClass).when(treeItem).getCSSClass(item);
when(element.getClassList()).thenReturn(classList);
when(item.isEditable()).thenReturn(false);
treeItem.updateCSSClass();
verify(classList).add(cssClass);
verify(classList, never()).add("parent-node");
verify(classList, never()).add("editable");
}
Aggregations