use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.
the class DataTypeListItemTest method testHideTooltips.
@Test
public void testHideTooltips() {
final HTMLElement listItems = mock(HTMLElement.class);
final NodeList<Element> tooltips = spy(new NodeList<>());
final Element element0 = mock(Element.class);
final Element element1 = mock(Element.class);
doReturn(element0).when(tooltips).getAt(0);
doReturn(element1).when(tooltips).getAt(1);
tooltips.length = 2;
element0.parentNode = listItems;
element1.parentNode = listItems;
doReturn(listItems).when(dataTypeList).getListItems();
doReturn(tooltips).when(listItems).querySelectorAll(".tooltip");
listItem.hideTooltips();
verify(listItems).removeChild(element0);
verify(listItems).removeChild(element1);
}
use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.
the class DNDDataTypesHandlerContext method getFirstDataType.
private Optional<DataType> getFirstDataType(final DataType current) {
final NodeList<Node> nodes = dndDataTypesHandler.getDndListComponent().getDragArea().childNodes;
for (int i = 0; i < nodes.length; i++) {
final Element element = (Element) nodes.getAt(i);
final Integer elementY = DNDListDOMHelper.Position.getY(element);
final Integer elementX = DNDListDOMHelper.Position.getX(element);
if (elementY > HIDDEN_Y_POSITION && elementX == 0 && !element.classList.contains(DRAGGING)) {
final DataType dataType = getDataType(element);
if (dataType != null && !Objects.equals(current.getName(), dataType.getName())) {
return Optional.of(dataType);
}
}
}
return Optional.empty();
}
use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.
the class DataTypeListItem method hideTooltips.
void hideTooltips() {
final String selector = ".tooltip";
final NodeList<Element> tooltips = getDataTypeList().getListItems().querySelectorAll(selector);
for (int i = 0; i < tooltips.length; i++) {
ElementHelper.remove(tooltips.getAt(i));
}
}
use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.
the class DataTypeListView method getNestedElements.
private List<Element> getNestedElements(final String parentUUID) {
final String selector = "[" + PARENT_UUID_ATTR + "=\"" + parentUUID + "\"]";
final NodeList<Element> nestedElements = listItems.querySelectorAll(selector);
final List<Element> list = new ArrayList<>();
for (int i = 0; i < nestedElements.length; i++) {
final Element element = nestedElements.getAt(i);
final boolean isVisible = getDndListComponent().getPositionY(element) > -1;
if (isVisible) {
list.add(element);
}
}
return list;
}
use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.
the class FlashMessagesViewTest method testDisableWarningHighlight.
@Test
public void testDisableWarningHighlight() {
final String warningElementSelector = "." + WARNING_CSS_CLASS;
final HTMLElement element = mock(HTMLElement.class);
final HTMLElement parentElement = mock(HTMLElement.class);
final NodeList<Element> warningElements = spy(new NodeList<>());
final Element warningElement1 = mock(Element.class);
final Element warningElement2 = mock(Element.class);
doReturn(warningElement1).when(warningElements).getAt(0);
doReturn(warningElement2).when(warningElements).getAt(1);
doReturn(element).when(view).getElement();
when(parentElement.querySelectorAll(warningElementSelector)).thenReturn(warningElements);
element.parentNode = parentElement;
warningElements.length = 2;
warningElement1.classList = mock(DOMTokenList.class);
warningElement2.classList = mock(DOMTokenList.class);
view.disableWarningHighlight();
verify(warningElement1.classList).remove(WARNING_CSS_CLASS);
verify(warningElement2.classList).remove(WARNING_CSS_CLASS);
}
Aggregations