Search in sources :

Example 36 with DOMTokenList

use of elemental2.dom.DOMTokenList in project kie-wb-common by kiegroup.

the class DataTypeListViewTest method testShowArrowIconIfDataTypeHasChildrenWhenDataTypeHasChildren.

@Test
public void testShowArrowIconIfDataTypeHasChildrenWhenDataTypeHasChildren() {
    final DataType dataType = mock(DataType.class);
    final NodeList<Element> elementNodeList = new NodeList<>();
    final Element dataTypeRow = mock(Element.class);
    final Element dataTypeRowArrow = mock(Element.class);
    final DOMTokenList arrowClassList = mock(DOMTokenList.class);
    final String uuid = "uuid";
    dataTypeRowArrow.classList = arrowClassList;
    elementNodeList.length = 1;
    when(dataType.getUUID()).thenReturn(uuid);
    when(listItems.querySelectorAll("[" + PARENT_UUID_ATTR + "=\"uuid\"]")).thenReturn(elementNodeList);
    when(listItems.querySelector("[" + UUID_ATTR + "=\"uuid\"]")).thenReturn(dataTypeRow);
    when(dataTypeRow.querySelector(ARROW_BUTTON_SELECTOR)).thenReturn(dataTypeRowArrow);
    view.showArrowIconIfDataTypeHasChildren(dataType);
    verify(arrowClassList).remove(HIDDEN_CSS_CLASS);
}
Also used : DOMTokenList(elemental2.dom.DOMTokenList) Element(elemental2.dom.Element) HTMLAnchorElement(elemental2.dom.HTMLAnchorElement) HTMLElement(elemental2.dom.HTMLElement) HTMLDivElement(elemental2.dom.HTMLDivElement) HTMLButtonElement(elemental2.dom.HTMLButtonElement) NodeList(elemental2.dom.NodeList) DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType) Test(org.junit.Test)

Example 37 with DOMTokenList

use of elemental2.dom.DOMTokenList in project drools-wb by kiegroup.

the class GuidedDecisionTableAccordionItemView method setOpen.

@Override
public void setOpen(final boolean isOpen) {
    final DOMTokenList classList = content.classList;
    final String opened = "in";
    if (isOpen) {
        classList.add(opened);
    } else {
        classList.remove(opened);
    }
}
Also used : DOMTokenList(elemental2.dom.DOMTokenList)

Aggregations

DOMTokenList (elemental2.dom.DOMTokenList)37 Test (org.junit.Test)36 Element (elemental2.dom.Element)21 HTMLElement (elemental2.dom.HTMLElement)12 HTMLDivElement (elemental2.dom.HTMLDivElement)9 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)8 HTMLButtonElement (elemental2.dom.HTMLButtonElement)7 HTMLAnchorElement (elemental2.dom.HTMLAnchorElement)5 HTMLInputElement (elemental2.dom.HTMLInputElement)4 HTMLUListElement (elemental2.dom.HTMLUListElement)2 NodeList (elemental2.dom.NodeList)2 HTMLElement (org.jboss.errai.common.client.dom.HTMLElement)2 HTMLBodyElement (elemental2.dom.HTMLBodyElement)1 HTMLDocument (elemental2.dom.HTMLDocument)1