Search in sources :

Example 6 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement 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");
}
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 7 with HTMLElement

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

the class DecisionNavigatorTreeViewTest method testTreeItemUpdateCSSClassWhenItemHasChildren.

@Test
public void testTreeItemUpdateCSSClassWhenItemHasChildren() {
    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);
    treeItem.updateCSSClass();
    verify(classList).add(cssClass);
    verify(classList).add("parent-node");
    verify(classList).add("editable");
}
Also used : DecisionNavigatorItem(org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) TreeSet(java.util.TreeSet) Test(org.junit.Test)

Example 8 with HTMLElement

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

the class DecisionNavigatorTreeViewTest method testSave.

@Test
public void testSave() {
    final HTMLElement element = mock(HTMLElement.class);
    final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
    final org.jboss.errai.common.client.dom.DOMTokenList tokenList = mock(org.jboss.errai.common.client.dom.DOMTokenList.class);
    doNothing().when(treeItem).updateLabel();
    doReturn(element).when(treeItem).getElement();
    doReturn(item).when(treeItem).getItem();
    when(element.getClassList()).thenReturn(tokenList);
    treeItem.save();
    verify(item).setLabel(inputText.value);
    verify(tokenList).remove("editing");
    verify(treeItem).updateLabel();
    verify(item).onUpdate();
    verify(locker).fire(any());
}
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 9 with HTMLElement

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

the class SourceConfigurationParamsView method defaultOption.

private HTMLElement defaultOption() {
    final HTMLElement option = Window.getDocument().createElement("option");
    option.setAttribute("value", "");
    option.setAttribute("disabled", "");
    option.setAttribute("selected", "");
    option.setTextContent(translationService.getTranslation(SourceConfigurationPageView_SelectOption_placeholder));
    return option;
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement)

Example 10 with HTMLElement

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

the class FormGeneratorDriver method createRow.

@Override
public HTMLElement createRow(LayoutRow layoutRow) {
    HTMLElement row = document.createElement(CONTAINER_TAG);
    row.setClassName(ROW_CLASS);
    return row;
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement)

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