Search in sources :

Example 31 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class DecisionNavigatorTreeViewTest method testOnEditClick.

@Test
public void testOnEditClick() {
    final HTMLElement element = mock(HTMLElement.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();
    when(element.getClassList()).thenReturn(tokenList);
    treeItem.onEditClick(event);
    verify(tokenList).add("editing");
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Test(org.junit.Test)

Example 32 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class DecisionNavigatorTreeViewTest method testTreeItemToggle.

@Test
public void testTreeItemToggle() {
    final HTMLElement element = mock(HTMLElement.class);
    final org.jboss.errai.common.client.dom.DOMTokenList classList = mock(org.jboss.errai.common.client.dom.DOMTokenList.class);
    doReturn(element).when(treeItem).getElement();
    doReturn(classList).when(element).getClassList();
    treeItem.toggle();
    verify(classList).toggle("closed");
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Example 33 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class DecisionNavigatorTreeViewTest method testTreeItemUpdateCSSClassWhenItemDoesNotHaveChildrenAndIsReadOnly.

@Test
public void testTreeItemUpdateCSSClassWhenItemDoesNotHaveChildrenAndIsReadOnly() {
    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);
    when(readOnlyProvider.isReadOnlyDiagram()).thenReturn(true);
    treeItem.updateCSSClass();
    verify(classList).add(cssClass);
    verify(classList, never()).add("parent-node");
    verify(classList, never()).add("editable");
}
Also used : DecisionNavigatorItem(org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Example 34 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class DecisionNavigatorTreeViewTest method testTreeItemUpdateDataUUID.

@Test
public void testTreeItemUpdateDataUUID() {
    final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
    final HTMLElement element = mock(HTMLElement.class);
    final String uuid = "uuid";
    doReturn(item).when(treeItem).getItem();
    doReturn(element).when(treeItem).getElement();
    when(item.getUUID()).thenReturn(uuid);
    treeItem.updateDataUUID();
    verify(element).setAttribute("data-uuid", uuid);
}
Also used : DecisionNavigatorItem(org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Example 35 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement 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);
}
Also used : DecisionNavigatorItem(org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Aggregations

HTMLElement (org.jboss.errai.common.client.dom.HTMLElement)46 Test (org.junit.Test)29 DecisionNavigatorItem (org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem)10 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 TreeSet (java.util.TreeSet)2 Node (org.jboss.errai.common.client.dom.Node)2 LayoutComponent (org.uberfire.ext.layout.editor.api.editor.LayoutComponent)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Element (elemental2.dom.Element)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 HTMLInputElement (elemental2.dom.HTMLInputElement)1 HTMLUListElement (elemental2.dom.HTMLUListElement)1 Text (elemental2.dom.Text)1 JsOverlay (jsinterop.annotations.JsOverlay)1 FlowPanel (org.gwtbootstrap3.client.ui.gwt.FlowPanel)1 Button (org.jboss.errai.common.client.dom.Button)1 CSSStyleDeclaration (org.jboss.errai.common.client.dom.CSSStyleDeclaration)1 Event (org.jboss.errai.common.client.dom.Event)1 EventListener (org.jboss.errai.common.client.dom.EventListener)1 ParameterItem (org.kie.workbench.common.dmn.client.widgets.decisionservice.parameters.parametergroup.ParameterGroup.ParameterItem)1