@Test public void testAppendBackgroundLine() { final DataType person = mock(DataType.class); final DataType personAge = mock(DataType.class); final DataType personName = mock(DataType.class); final DataType personAddress = mock(DataType.class); final String personUUID = "0000"; final String personAgeUUID = "1111"; final String personNameUUID = "2222"; final String personAddressUUID = "3333"; final String personAddressStreetUUID = "4444"; final DataType personAddressStreet = mock(DataType.class); final DataTypeListItem personItem = mock(DataTypeListItem.class); final DataTypeListItem personAgeItem = mock(DataTypeListItem.class); final DataTypeListItem personNameItem = mock(DataTypeListItem.class); final DataTypeListItem personAddressItem = mock(DataTypeListItem.class); final DataTypeListItem personAddressStreetItem = mock(DataTypeListItem.class); final Element backgroundLine = mock(Element.class); final HTMLElement element = mock(HTMLElement.class); final NodeList<Element> nodeList = new NodeList<>(); backgroundLine.classList = mock(DOMTokenList.class); element.offsetHeight = 70; nodeList.length = 3; doReturn(backgroundLine).when(helper).createElement("div"); doReturn(nodeList).when(helper).querySelectorAll(".kie-dnd-current-dragging"); doReturn(Optional.of(personItem)).when(helper).getDataTypeListItem(personUUID); doReturn(Optional.of(personAgeItem)).when(helper).getDataTypeListItem(personAgeUUID); doReturn(Optional.of(personNameItem)).when(helper).getDataTypeListItem(personNameUUID); doReturn(Optional.of(personAddressItem)).when(helper).getDataTypeListItem(personAddressUUID); doReturn(Optional.of(personAddressStreetItem)).when(helper).getDataTypeListItem(personAddressStreetUUID); when(person.getUUID()).thenReturn(personUUID); when(personAge.getUUID()).thenReturn(personAgeUUID); when(personName.getUUID()).thenReturn(personNameUUID); when(personAddress.getUUID()).thenReturn(personAddressUUID); when(personAddressStreet.getUUID()).thenReturn(personAddressStreetUUID); when(personItem.isCollapsed()).thenReturn(false); when(personAgeItem.isCollapsed()).thenReturn(false); when(personNameItem.isCollapsed()).thenReturn(false); when(personAddressItem.isCollapsed()).thenReturn(true); when(personAddressStreetItem.isCollapsed()).thenReturn(false); when(person.getSubDataTypes()).thenReturn(asList(personAge, personName, personAddress)); when(personAddress.getSubDataTypes()).thenReturn(singletonList(personAddressStreet)); helper.appendBackgroundLine(person, element); verify(backgroundLine.classList).add(LEVEL_BACKGROUND_LINE); verify(element).appendChild(backgroundLine); verify(backgroundLine).setAttribute("style", "height: 490px"); }
void appendBackgroundLine(final DataType dataType, final HTMLElement element) { final int numberOfDataTypes = numberOfSubDataTypes(dataType) + numberOfDraggingElements(); final Element backgroundLine = createBackgroundLine(); final int dataTypeRow = (int) element.offsetHeight; final int lineHeight = dataTypeRow * numberOfDataTypes; element.appendChild(backgroundLine); backgroundLine.setAttribute("style", "height: " + lineHeight + "px"); }
DataTypeListHighlightHelper { void appendBackgroundLine(final DataType dataType, final HTMLElement element) { final int numberOfDataTypes = numberOfSubDataTypes(dataType) + numberOfDraggingElements(); final Element backgroundLine = createBackgroundLine(); final int dataTypeRow = (int) element.offsetHeight; final int lineHeight = dataTypeRow * numberOfDataTypes; element.appendChild(backgroundLine); backgroundLine.setAttribute("style", "height: " + lineHeight + "px"); } }
DataTypeListHighlightHelper { void appendBackgroundLine(final DataType dataType, final HTMLElement element) { final int numberOfDataTypes = numberOfSubDataTypes(dataType) + numberOfDraggingElements(); final Element backgroundLine = createBackgroundLine(); final int dataTypeRow = (int) element.offsetHeight; final int lineHeight = dataTypeRow * numberOfDataTypes; element.appendChild(backgroundLine); backgroundLine.setAttribute("style", "height: " + lineHeight + "px"); } @Inject  DataTypeListHighlightHelper(final DataTypeUtils dataTypeUtils); }
DataTypeListHighlightHelper { void appendBackgroundLine(final DataType dataType, final HTMLElement element) { final int numberOfDataTypes = numberOfSubDataTypes(dataType) + numberOfDraggingElements(); final Element backgroundLine = createBackgroundLine(); final int dataTypeRow = (int) element.offsetHeight; final int lineHeight = dataTypeRow * numberOfDataTypes; element.appendChild(backgroundLine); backgroundLine.setAttribute("style", "height: " + lineHeight + "px"); } @Inject  DataTypeListHighlightHelper(final DataTypeUtils dataTypeUtils); void init(final DataTypeList dataTypeList); void highlightLevel(final Element element); void highlight(final Element element); void cleanHighlightClass(); void cleanLevelHighlightClass(); DataTypeList getDataTypeList(); }
DataTypeListHighlightHelper { void appendBackgroundLine(final DataType dataType, final HTMLElement element) { final int numberOfDataTypes = numberOfSubDataTypes(dataType) + numberOfDraggingElements(); final Element backgroundLine = createBackgroundLine(); final int dataTypeRow = (int) element.offsetHeight; final int lineHeight = dataTypeRow * numberOfDataTypes; element.appendChild(backgroundLine); backgroundLine.setAttribute("style", "height: " + lineHeight + "px"); } @Inject  DataTypeListHighlightHelper(final DataTypeUtils dataTypeUtils); void init(final DataTypeList dataTypeList); void highlightLevel(final Element element); void highlight(final Element element); void cleanHighlightClass(); void cleanLevelHighlightClass(); DataTypeList getDataTypeList();  }