@Test public void testCollapse() { final HTMLElement arrow = mock(HTMLElement.class); final DOMTokenList arrowClassList = mock(DOMTokenList.class); doReturn(arrow).when(view).getArrow(); arrow.classList = arrowClassList; final DataType parentDataType = mock(DataType.class); final String parentDataTypeUUID = "parentDataTypeUUID"; final Element parentElement = mock(Element.class); final Element child1 = makeChildElement("child1UUID"); final Element child2 = makeChildElement("child2UUID"); final NodeList<Element> children = spy(new NodeList<>()); when(parentDataType.getUUID()).thenReturn(parentDataTypeUUID); when(parentElement.getAttribute("data-row-uuid")).thenReturn(parentDataTypeUUID); doReturn(parentDataType).when(view).getDataType(); doReturn(child1).when(children).getAt(0); doReturn(child2).when(children).getAt(1); mockDOMElementByUUID(parentDataTypeUUID, parentElement); mockDOMElementsByParentUUID(parentDataTypeUUID, children); children.length = 2; view.collapse(); verify(arrowClassList).remove(DOWN_ARROW_CSS_CLASS); verify(arrowClassList).add(RIGHT_ARROW_CSS_CLASS); verify(child1.classList).add(HIDDEN_CSS_CLASS); verify(child2.classList).add(HIDDEN_CSS_CLASS); }
@Override public void collapse() { final Element parent = getRowElement(getDataType()); asRightArrow(getArrow()); forEachChildElement(parent, element -> { presenter.setPositionY(element, -2); HiddenHelper.hide(element); }); presenter.refreshItemsCSSAndHTMLPosition(); }
DataTypeListItemView implements DataTypeListItem.View { @Override public void collapse() { final Element parent = getRowElement(getDataType()); asRightArrow(getArrow()); forEachChildElement(parent, element -> { presenter.setPositionY(element, -2); HiddenHelper.hide(element); }); presenter.refreshItemsCSSAndHTMLPosition(); } }
DataTypeListItemView implements DataTypeListItem.View { @Override public void collapse() { final Element parent = getRowElement(getDataType()); asRightArrow(getArrow()); forEachChildElement(parent, element -> { presenter.setPositionY(element, -2); HiddenHelper.hide(element); }); presenter.refreshItemsCSSAndHTMLPosition(); } @Inject  DataTypeListItemView(final HTMLDivElement view,
                                final TranslationService translationService,
                                final @DMNEditor ReadOnlyProvider readOnlyProvider); }
DataTypeListItemView implements DataTypeListItem.View { @Override public void collapse() { final Element parent = getRowElement(getDataType()); asRightArrow(getArrow()); forEachChildElement(parent, element -> { presenter.setPositionY(element, -2); HiddenHelper.hide(element); }); presenter.refreshItemsCSSAndHTMLPosition(); } @Inject  DataTypeListItemView(final HTMLDivElement view,
                                final TranslationService translationService,
                                final @DMNEditor ReadOnlyProvider readOnlyProvider); @Override void init(final DataTypeListItem presenter); @Override HTMLElement getElement(); @Override void toggleArrow(final boolean show); @Override void expand(); @Override void collapse(); @Override void showEditButton(); @Override void showSaveButton(); @Override void enableFocusMode(); @Override void disableFocusMode(); @Override boolean isOnFocusMode(); @Override String getName(); @Override void setName(final String name); @Override void showDataTypeNameInput(); @Override void hideDataTypeNameInput(); @Override void setupSelectComponent(final DataTypeSelect typeSelect); @Override void setupConstraintComponent(final DataTypeConstraint dataTypeConstraintComponent); @Override void setupListComponent(final SmallSwitchComponent dataTypeListComponent); @Override void showListContainer(); @Override void hideListContainer(); @Override void showListYesLabel(); @Override void hideListYesLabel(); @Override boolean isCollapsed(); @Override void setDataType(final DataType dataType); }
DataTypeListItemView implements DataTypeListItem.View { @Override public void collapse() { final Element parent = getRowElement(getDataType()); asRightArrow(getArrow()); forEachChildElement(parent, element -> { presenter.setPositionY(element, -2); HiddenHelper.hide(element); }); presenter.refreshItemsCSSAndHTMLPosition(); } @Inject  DataTypeListItemView(final HTMLDivElement view,
                                final TranslationService translationService,
                                final @DMNEditor ReadOnlyProvider readOnlyProvider); @Override void init(final DataTypeListItem presenter); @Override HTMLElement getElement(); @Override void toggleArrow(final boolean show); @Override void expand(); @Override void collapse(); @Override void showEditButton(); @Override void showSaveButton(); @Override void enableFocusMode(); @Override void disableFocusMode(); @Override boolean isOnFocusMode(); @Override String getName(); @Override void setName(final String name); @Override void showDataTypeNameInput(); @Override void hideDataTypeNameInput(); @Override void setupSelectComponent(final DataTypeSelect typeSelect); @Override void setupConstraintComponent(final DataTypeConstraint dataTypeConstraintComponent); @Override void setupListComponent(final SmallSwitchComponent dataTypeListComponent); @Override void showListContainer(); @Override void hideListContainer(); @Override void showListYesLabel(); @Override void hideListYesLabel(); @Override boolean isCollapsed(); @Override void setDataType(final DataType dataType); static final String UUID_ATTR; static final String NAME_DATA_FIELD; static final String PARENT_UUID_ATTR; }