use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemUpdateTitle.
@Test
public void testTreeItemUpdateTitle() {
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final HTMLElement element = mock(HTMLElement.class);
final String label = "label";
doReturn(item).when(treeItem).getItem();
doReturn(element).when(treeItem).getElement();
when(item.getLabel()).thenReturn(label);
treeItem.updateTitle();
verify(element).setAttribute("title", label);
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemUpdateCSSClassWhenItemHasChildrenAndIsReadOnly.
@Test
public void testTreeItemUpdateCSSClassWhenItemHasChildrenAndIsReadOnly() {
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final DecisionNavigatorItem child = mock(DecisionNavigatorItem.class);
final TreeSet<DecisionNavigatorItem> children = new TreeSet<DecisionNavigatorItem>() {
{
add(child);
}
};
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.getChildren()).thenReturn(children);
when(item.isEditable()).thenReturn(true);
when(readOnlyProvider.isReadOnlyDiagram()).thenReturn(true);
treeItem.updateCSSClass();
verify(classList).add(cssClass);
verify(classList).add("parent-node");
verify(classList, never()).add("editable");
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemUpdateLabel.
@Test
public void testTreeItemUpdateLabel() {
final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
final Text textNode = mock(Text.class);
final String label = "label";
doReturn(item).when(treeItem).getItem();
doReturn(textNode).when(treeItem).getTextNode(label);
when(item.getLabel()).thenReturn(label);
treeItem.updateLabel();
assertEquals(label, inputText.value);
verify(textContent).appendChild(textNode);
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemSetup.
@Test
public void testTreeItemSetup() {
final DecisionNavigatorItem expectedItem = mock(DecisionNavigatorItem.class);
final Element children = mock(Element.class);
doNothing().when(treeItem).updateDataUUID();
doNothing().when(treeItem).updateTitle();
doNothing().when(treeItem).updateCSSClass();
doNothing().when(treeItem).updateLabel();
doNothing().when(treeItem).updateSubItems(children);
doNothing().when(treeItem).initOuiaComponentAttributes();
final DecisionNavigatorTreeView.TreeItem actualTreeItem = treeItem.setup(expectedItem, children);
final DecisionNavigatorItem actualItem = treeItem.getItem();
verify(treeItem).updateDataUUID();
verify(treeItem).updateTitle();
verify(treeItem).updateCSSClass();
verify(treeItem).updateLabel();
verify(treeItem).updateSubItems(children);
verify(treeItem).initOuiaComponentAttributes();
assertEquals(treeItem, actualTreeItem);
assertEquals(expectedItem, actualItem);
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testSetup.
@Test
public void testSetup() {
final List<DecisionNavigatorItem> items = new ArrayList<>();
final Element element = mock(Element.class);
doReturn(element).when(treeView).makeTree(items);
treeView.setup(items);
verify(this.items).appendChild(element);
}
Aggregations